Code Diff Visualizer

Side-by-side code diff with syntax highlighting, line numbers, and statistics.

Original Code

Modified Code

Usage

This tool compares two code snippets using the Longest Common Subsequence (LCS) algorithm to highlight line-level differences.

Features

  • Side-by-side input for original and modified code
  • Highlighted diff: green for additions, red for deletions
  • Line number mapping between old and new code
  • Statistics for added, removed, and changed lines
  • @@ markers to group diff sections

Steps

  1. Paste the old version code into the left "Original Code" box
  2. Paste the new version code into the right "Modified Code" box
  3. Click "Sample" to load example code for a quick demo
  4. Diff results appear in real time in the comparison area below
  5. Check the statistics card for an overview of changes

Notes

  • Diff is line-level only; character-level diff is not supported
  • Large files may take time; recommended under 1000 lines
  • Whitespace differences are treated as different lines
  • All computation runs locally in your browser; code is not uploaded