Diff checker
Compare two texts line by line and see exactly what changed. Runs in your browser.
Runs 100% in your browserHow to compare two texts
- Paste both versions. Original on the left, changed on the right.
- Read the diff. Removed lines are red, added lines green, unchanged lines plain.
What a diff shows you
A diff is a precise, side-by-side answer to one question: what changed between two versions of a document? It's how code review, version control and document-comparison tools all work — instead of re-reading both copies and hoping to spot the edits, you get every removal and addition highlighted. This tool compares line by line (rather than character by character), which keeps the output readable and matches what you see in a pull request: removed lines in red, added lines in green, unchanged lines plain. It works equally well on source code, configuration files, prose drafts and exported data.
How line-based diffing works
Under the hood is the same idea git uses: a longest-common-subsequence algorithm. It finds the largest set of lines that appear in the same order in both texts — those are the lines that didn't change — and then everything left over on the original side is marked removed, and everything left over on the new side is marked added. Anchoring on the longest shared run is what stops a single early edit from making every line below it look different; it's why a good diff lines up the unchanged context around your actual changes. The trade-off is granularity: because it reasons about whole lines, changing one word inside a line shows that line as a removal plus an addition, not a word-level tweak.
Getting a clean diff
A line counts as unchanged only if it matches exactly, so trailing spaces, tabs-versus-spaces and different line endings can make identical-looking lines show as changed. The most common source of a noisy diff is reflowed text — when wrapping shifts, every wrapped line moves and the diff lights up. If the result looks messier than the real change, normalise both sides first: trim trailing whitespace, use one consistent indentation, and keep one sentence or statement per line so edits stay localised.
When a structural diff is better
Line diffing is the right tool when line order carries meaning — code, logs, plain text. It's the wrong tool when formatting is incidental: two JSON objects that are semantically identical but have keys in a different order, or different indentation, will show as completely different line by line. For that, compare by structure instead with the JSON diff tool, which ignores key ordering and whitespace. Either way the comparison runs entirely on your device, so it's safe for confidential files. When you need to reshape one side before comparing, the case converter and JSON formatter help normalise it first.
Frequently asked questions
- It compares the two texts line by line using a longest-common-subsequence (LCS) algorithm, then marks lines that were added, removed or unchanged — the same core approach as git and most diff tools.
- The algorithm finds the largest set of lines that appear, in the same order, in both versions — the lines that didn't change. Everything left over on the original side is shown as removed, and everything left over on the new side as added. Anchoring on the longest common run is what makes the result match human intuition about "what actually changed" rather than flagging everything after the first difference.
- Yes — lines must match exactly to count as unchanged, so a changed capital letter, a trailing space, or tabs-vs-spaces will mark a line as different. If you want to ignore those, trim and normalise both sides first.
- Line diffs work at line granularity: editing one word rewrites the entire line, so that line shows as one removal plus one addition. Reflowed paragraphs (where wrapping shifts) are the usual cause of a noisy diff — keep one sentence or statement per line, or normalise wrapping, for a cleaner result.
- Any text works, and line-diffing is exactly how code review tools present changes. For comparing JSON by structure rather than by line — so reordered keys or reformatting don't show as differences — use the dedicated JSON diff tool instead.
- No — the comparison runs entirely in your browser, so it is safe for comparing private or proprietary files.