Free tool
Diff checker: compare two texts
Free · no sign-up · runs in your browser, nothing is uploaded
Paste two texts above, drop two files, or press Sample. Differences show here as you type.
How this diff checker works
Both texts are split into lines and compared with the Myers diff algorithm, the same approach GNU diff and git use by default. It finds the smallest set of lines to remove and add to turn the original into the changed text. When a block of removed lines sits right next to a block of added lines, they are paired up as changed lines, and a second pass compares each pair by word or by character to highlight what actually changed.
Pick Side by side to read both versions in parallel, or Inline for a single column like a pull request. Only changes folds long runs of unchanged lines down to 3 lines of context, and the prev/next buttons jump between blocks of changes. The stats count added, removed, changed and unchanged lines, and the similarity is 2 × matching lines ÷ total lines, the same ratio Python's difflib.SequenceMatcher.ratio() reports.
Everything runs in your browser. Big files are fine: the diff waits for a short pause in typing, and very different inputs stop after a few seconds with a message instead of freezing the tab.
Ignore whitespace, case and line endings
Many "changes" are only formatting: an editor that strips trailing spaces, code that was reindented, or a file saved on Windows with CRLF line endings. The options above match the flags of GNU diff and git diff, so the result here is what you would get in a terminal:
| Option | What it ignores | GNU diff | git diff |
|---|---|---|---|
| Compare all | every character counts | (default) | (default) |
| Ignore trailing | spaces and tabs at line end | -Z, --ignore-trailing-space | --ignore-space-at-eol |
| Ignore amount | runs of spaces count as one | -b, --ignore-space-change | -b |
| Ignore all | all whitespace removed | -w, --ignore-all-space | -w |
| Ignore blank lines | empty lines skipped | -B, --ignore-blank-lines | --ignore-blank-lines |
| Ignore case | A equals a | -i, --ignore-case | (none) |
| Ignore CRLF vs LF | Windows line endings | --strip-trailing-cr | --ignore-cr-at-eol |
| Ignore text matching | text a regex matches, such as timestamps | -I RE (whole lines only) | -I RE (whole lines only) |
Ignore text matching takes a JavaScript regular expression and removes what it matches from each line before comparing, so a line that only differs in a timestamp, build number or request ID counts as unchanged. For ISO timestamps, try \d{4}-\d\d-\d\dT[\d:.]+Z?. GNU diff and git have -I, which is stricter: it only skips a change when every changed line matches. Sort lines sorts both sides first, which is the quickest way to compare two lists (package names, env keys, emails) when order does not matter.
Ignored differences still show the real text. If two lines only differ in spacing and you ignore whitespace, they count as unchanged and the right-hand version is shown. The tool also tells you when only one side ends with a newline or uses CRLF, since those are invisible in most editors.
How to read a unified diff
The patch you can copy or download is a unified diff, the format of diff -u, git diff and most code review tools. The ignore options do not change it, so it stays exact and git apply and patch can apply it. Only "Compare as JSON" and "Sort lines" change it, because they rewrite the texts before comparing:
--- a/config.yml +++ b/config.yml @@ -1,4 +1,4 @@ server: - port: 8080 + port: 3000 host: 0.0.0.0 timeout: 30
--- and +++ name the old and new file. Each hunk starts with @@ -1,4 +1,4 @@: the start line and number of lines in the old file, then in the new file. Lines starting with - were removed, + were added, and a space means unchanged context (3 lines around each change by default). A line \ No newline at end of file means the last line has no line break after it.
Compare files in the terminal and in code
The same comparison without a browser, for scripts and CI:
# Unified diff of two files (macOS, Linux) diff -u old.txt new.txt # Ignore whitespace changes and blank lines diff -u -b -B old.txt new.txt # Git's diff works on any two files, even outside a repo, with word highlights git diff --no-index --word-diff old.txt new.txt # Open a side-by-side diff in VS Code code --diff old.txt new.txt # Windows cmd fc old.txt new.txt
# Python: difflib is in the standard library
import difflib
a = open("old.txt").read().splitlines(keepends=True)
b = open("new.txt").read().splitlines(keepends=True)
print("".join(difflib.unified_diff(a, b, "old.txt", "new.txt")))
print(difflib.SequenceMatcher(None, a, b).ratio()) # similarity 0..1// JavaScript: the jsdiff package (npm i diff), which this page uses too
import { createTwoFilesPatch, diffWords } from 'diff';
const patch = createTwoFilesPatch('old.txt', 'new.txt', oldText, newText);
const words = diffWords('the quick fox', 'the slow fox'); // [{value:'the '}, {removed:true, value:'quick'}, ...]Compare JSON without false differences
Two JSON documents can hold the same data and still look different: keys in another order, other indentation, everything on one line. A plain text diff marks all of that. Compare as JSON parses both sides and prints them the same way first, with keys sorted at every level, so only real changes in values remain. Numbers are kept exactly as written, so a long ID like 12345678901234567890 is not rounded. Array order still counts, because in JSON it is part of the data.
On the command line, diff <(jq -S . a.json) <(jq -S . b.json) does the same with jq. To clean up or validate one document first, use the JSON formatter. For YAML configs, convert them with YAML to JSON and compare the results. Looking for diff and merge tools you install? Browse CLI tools on DevHunt.
More free developer tools
FAQ
What is a diff checker?+
A diff checker compares two versions of a text and shows what changed: lines that were added, removed or edited. The name comes from the Unix diff command. This one also marks the exact words or characters that changed inside an edited line.
How do I compare two texts to see if they are the same?+
Paste one text into Original and the other into Changed. If they match, the tool says "No differences" right away. If they do not, the stats show how many lines were added, removed or changed, and the diff below shows where. Turn on the ignore options when spaces, letter case or line endings should not count.
Is this diff checker free and private?+
Yes. It is free with no sign-up, and you can open files up to 20 MB on each side. The comparison runs in your browser and nothing is uploaded. Short texts are kept in the page URL so you can share a result; texts over 1,500 characters stay out of the URL.
What program can I use to compare two text files?+
On macOS and Linux, run diff -u old.txt new.txt or git diff --no-index old.txt new.txt in a terminal. On Windows, fc old.txt new.txt works in cmd. In VS Code, run code --diff old.txt new.txt or right-click two files and pick "Compare Selected". For a quick check without installing anything, drop both files on this page.
How do I compare two JSON files?+
Turn on "Compare as JSON". Both sides are parsed and printed with sorted keys and the same indentation, so only real changes in data show up, not key order or formatting. Numbers are kept exactly as written. If one side is not valid JSON, you see the line and column of the error.
How do I create a patch file from two texts?+
Compare them here and press download next to "patch". You get a unified diff with a/ and b/ file headers that git apply or patch -p1 can apply. In a terminal, diff -u old new > change.patch does the same.
How do I compare two lists and find what is missing?+
Paste one list on each side and turn on "Sort lines". Both lists are sorted before comparing, so lines only in the original show as removed and lines only in the changed list show as added, whatever the order was. Turn on "Ignore case" and "Ignore all" whitespace too if "Apple " and "apple" should count as the same item.
Can I compare Word documents or PDFs?+
Not directly. This tool compares plain text, and a .docx or .pdf file is binary. Copy the text out of both documents and paste it here, or use the compare feature in Word (Review > Compare) for formatted documents.
Sources: GNU diffutils manual · GNU diff: unified format · git diff · jsdiff · Myers (1986), An O(ND) Difference Algorithm · Python difflib · VS Code command line. Checked October 2026.