Tools

Diff Viewer

Compare two texts and visualize the differences.

Original
Ln:1 Col:11 lines
Modified
Ln:1 Col:11 lines
Diff Result
Original
Modified
Enter two texts and click the Compare button.

About Diff Viewer

Text diff tools are fundamental to software development — version control systems like Git use diff algorithms to track code changes, and code review platforms use side-by-side diff views to highlight modifications. Whether you're comparing API responses, configuration files, document revisions, or code snippets, a diff viewer instantly shows exactly what changed between two versions.

How Diff Algorithms Work

This tool implements the LCS (Longest Common Subsequence) algorithm — the same core approach used by Unix diff and Git. LCS finds the maximum set of lines that are identical between two texts, then classifies remaining lines as added (green) or removed (red). The result is a minimal diff that precisely identifies what changed with the fewest possible edit operations.

Common diff use cases in development: comparing JSON API responses before and after a code change to verify behavior, reviewing configuration differences between environments (dev/staging/prod), checking output changes in automated test results, auditing document revisions, and debugging unexpected behavior by diffing log outputs. Side-by-side view (as shown here) is generally preferred over unified diff (+/-) format for readability when changes are sparse.

FAQ

What is the difference between unified diff and side-by-side diff?
Unified diff shows changes with +/- markers in a single column (default for git diff); side-by-side displays original and modified text in parallel. Side-by-side is preferred for code reviews.
Can whitespace differences be ignored?
Many diff tools offer options to ignore trailing whitespace, indentation changes, and line-ending differences. In git diff, use the --ignore-all-space (-w) flag.
Can binary files be compared?
Text diff tools are for text files only. For image comparison, use dedicated tools (Beyond Compare, Kaleidoscope, etc.); for binary comparison, use hex diff tools.