What is a diff checker?
A diff checker is a tool that compares two versions of a text and lists the differences between them. "Diff" is short for difference, and it's also the name of the Unix diff program from the 1970s that made the idea standard.
You give it an original and a changed version. It works out the smallest set of lines to delete and insert to turn one into the other, then shows those edits. Everything else is marked unchanged. People use a diff text checker to review contract edits, spot what a colleague changed in a config file, check two API responses, or confirm that a copy-pasted block really matches the source.
- Text compare: two drafts of an email, an essay or terms of service.
- Code: two versions of a function, a stylesheet or a SQL query.
- Data: JSON, CSV, XML or YAML exports that should match but don't.
- Lists: two lists of emails, URLs or product IDs, to see what was added or dropped.
How to compare text online with this diff checker
Paste both versions and read the colours. The other controls cut noise out of the result.
- Put the older version in Original text and the newer one in Changed text. Order matters: lines only in the original show as removed.
- Look at the counters above the result: added, removed and changed lines. A changed line is a removed line paired with an added one in the same spot.
- Choose Side by side to read both versions in parallel, or Inline for a single column in the style of
git diff. On a phone, side by side stacks each original line above its replacement so nothing scrolls sideways. - Long unchanged stretches fold into a single bar. Set how many unchanged lines stay visible around each change, or pick Show everything.
- Use Swap sides if you pasted them the wrong way round.
How does a diff checker find the changes?
It looks for the longest run of lines the two versions share, in order, and treats everything else as edits. That shared run is called the longest common subsequence. Finding it quickly is the hard part.
This online diff checker uses Myers' O(ND) algorithm, published by Eugene Myers in 1986 and still the default in git diff and GNU diff. Its running time grows with the size of the input times the number of differences, so two long files with a few edits compare almost instantly. We use the linear-memory version, which splits the problem at a midpoint and solves each half, so a 10,000-line file doesn't need a huge table in memory.
Word and character highlights
After the line diff, each removed line is paired with the added line in the same position. The tool then runs the same algorithm again on the words (or single characters) of that pair, so you see that only debug became info instead of re-reading the whole line. If two paired lines share less than about a third of their text, the whole line is highlighted instead, because scattered one-letter matches are harder to read than a plain replacement.
Ignore whitespace, case or blank lines: which option to use
Turn an option on when a kind of difference doesn't matter to you and is burying the ones that do. Each option only changes how lines are matched; the text shown is always your original text.
| Option | What it ignores | Use it when | Git flag |
|---|---|---|---|
| Ignore all whitespace | Every space, tab and indent difference | Code was re-indented or reformatted | -w |
| Ignore trailing whitespace | Spaces and tabs at the end of lines | An editor stripped or added trailing spaces | --ignore-space-at-eol |
| Ignore case | Upper vs lower case | Comparing lists of emails, headings or SQL keywords | none (GNU diff -i) |
| Ignore blank lines | Added or removed empty lines | Paragraph spacing changed in prose or code | --ignore-blank-lines |
| JSON mode | Formatting and (optionally) key order | Comparing API responses or config files | none |
Windows (CRLF) and Unix (LF) line endings are always treated as the same, so a file saved on another system doesn't light up every line. A missing newline at the very end of a file does count, because tools like Git treat it as a real change; the result tells you when that is the only difference.
Using it as a JSON, XML, CSV or HTML diff checker
Structured data needs one extra step before a line diff is useful: both sides must be laid out the same way. For JSON the tool does that for you; for other formats, format both sides first.
- JSON diff checker
- Tick JSON mode. Both sides are parsed and re-printed with two-space indentation, so minified and pretty-printed JSON compare cleanly. Tick Sort JSON keys too, because JSON objects are unordered (RFC 8259) and
{"a":1,"b":2}equals{"b":2,"a":1}. Invalid JSON gets an error with its line and column. To tidy a single document, use the JSON formatter. - XML diff checker
- Pretty-print both files with the same indentation first, then turn on Ignore trailing whitespace. Attribute order still counts as a change, so sort attributes if your data allows it.
- CSV diff checker
- Each row is a line, so added and removed rows show directly and a changed cell is highlighted inside its row. Sort both files by the same key column first, or a reordered export will look like every row changed.
- HTML diff checker
- Works like any code diff. Minified HTML is one giant line, so format it before comparing; character highlights help find a single changed attribute.
Diff code checker: reading a unified diff and git diff output
A unified diff is the plain-text patch format that git diff, GitHub and code review tools use. Press Copy unified diff and you get exactly this format, so the tool doubles as a git diff checker for snippets you don't have in a repository.
--- config.old.yml
+++ config.yml
@@ -1,5 +1,5 @@
# App settings
name: my-app
-version: 1.4.0
+version: 1.5.0
language: en
timezone: UTC---and+++name the original and changed file.@@ -1,5 +1,5 @@is a hunk header: this block starts at line 1 and covers 5 lines in each file.- Lines starting with
-were removed,+were added, and a space means unchanged context (3 lines by default). \ No newline at end of filemarks a last line with no line break after it.
The patch is built from the text as you entered it, so it applies cleanly with git apply or patch. With an ignore option on, the patch follows that filtered comparison, the same as git diff -w, so treat it as something to read rather than apply.
File diff checker: comparing two files and large inputs
Press Open file on each side or drag a file onto a box. Any plain-text file works: .txt, .md, .json, .csv, .xml, .html, source code, logs. The file is read by your browser and never uploaded.
- Up to 5 MB per file and 20,000 lines per side.
- Binary files (images, PDFs, Word documents) are rejected with a message, because a line diff of their raw bytes means nothing. Save Word or Google Docs files as plain text first.
- If two very large inputs are almost completely different, the tool stops searching for the minimal diff after a fixed amount of work and shows those regions as replaced whole. The result says so when that happens.
- Only the first 4,000 rows are drawn at first; a button renders the rest, so the page stays responsive.
For whole folders or repositories, use git diff --no-index folder-a folder-b on your own machine. It uses the same algorithm and handles any size.
Online diff checker vs desktop and editor tools
An online diff checker is fastest for one-off comparisons, especially on a borrowed or locked-down computer. For daily work on code, the tools you already have are often better.
| Tool | Best for | Install needed | Text leaves your device |
|---|---|---|---|
| This diff checker | Quick text compare, JSON, snippets, phones | No | No |
git diff / diff -u | Files and folders in a project | Yes (Git or diffutils) | No |
| VS Code compare | Code you are editing | Yes | No |
| Word Compare Documents | Formatted documents with tracked changes | Yes (Microsoft Word) | No |
| Diff sites that upload text | Sharing a diff by link | No | Yes, check their policy |
Developers who format and inspect data all day may prefer an extension in the toolbar; our JSON formatter use case and the JSON Formatter extension profile cover that, and tools for developers lists more.