// compare two texts · highlight added · removed · unchanged lines · nothing leaves your browser
A diff checker compares two versions of text and highlights what changed — lines added, removed, or unchanged. It's essential for code reviews, comparing document versions, spotting API response changes, or verifying that a refactor didn't accidentally change logic.
The core algorithm behind most diff tools is the Longest Common Subsequence (LCS) algorithm. Given two texts, it finds the longest sequence of lines that appear in both, in the same order. Everything not in this common sequence is either an addition (in the new text but not the old) or a deletion (in the old text but not the new).
This is the same algorithm used by Git, the Unix diff command, and code review tools like GitHub's pull request view. The output is called a "unified diff" format — lines starting with + were added, lines starting with - were removed, and unchanged lines provide context.
Common use cases include comparing two versions of a configuration file, reviewing changes in a document before sending it, debugging API responses that should be identical, comparing database schema versions, and verifying that a minified file contains the same content as its source.
When comparing JSON or code, format it first using the JSON formatter or a code formatter. Comparing minified vs formatted versions of the same content will show every line as different even though the data is identical. Consistent formatting makes the diff show only meaningful changes.
For large files, focus on the changed sections rather than reading every unchanged line. The statistics (added, removed, unchanged) give you a quick sense of how significant the changes are. A diff showing 2 added and 1 removed line in a 500-line file is a minor change; a diff showing 200 changes is substantial and warrants careful review.