Code Diff Viewer

Compare two code blocks with syntax-highlighted diffs.

Frequently Asked Questions

What algorithm does this diff tool use? +
It uses a longest common subsequence (LCS) algorithm to find the minimal set of changes between two texts. This is the same approach used by most version control systems like Git.
What is the difference between side-by-side and unified diff views? +
Side-by-side shows the original and modified text in two columns, so you can compare them visually. Unified view merges both into a single column with + and - prefixes, similar to what Git shows in the terminal.
Which programming languages are supported for syntax highlighting? +
The tool highlights JavaScript, Python, HTML, CSS, JSON, and SQL. It detects strings, comments, keywords, and numbers. You can also select Auto-detect to let it guess based on the content.
Can I collapse unchanged sections in the diff output? +
Yes. Unchanged lines that are far from any changes get collapsed into a clickable "show N hidden lines" bar. Click it to expand and see the full context.