What it does
The checker finds the longest sequence of lines that both texts share and marks everything else: lines starting with - exist only in the original, lines starting with + exist only in the changed text.
Options
- Ignore whitespace treats runs of spaces and tabs as equal and ignores leading and trailing spaces.
- Ignore case compares lines without regard to capitalisation.
- Ignore blank lines leaves empty and whitespace-only lines out of the comparison. They are also left out of the result and of Copy diff.
- Trim trailing whitespace ignores spaces and tabs at the end of a line when comparing; the lines are still shown as you typed them.
Views and highlights
Unified is the default and lists every line once. Side by side puts the original on the left and the changed text on the right; on narrow screens the two sides are stacked. Copy diff always gives the unified text. The line counts above the result show lines added, removed, changed (a removed line paired with an added line) and unchanged.
With Highlight changes inside lines switched on, a removed line and an added line in the same changed block are paired in order and only the parts that differ are marked: added text is underlined, removed text is struck through, so the marks do not depend on colour. Choose words (split at word and punctuation boundaries) or single characters. Lines that share less than about a third of their words are not marked inside, because the whole line is different anyway.
Limits
The comparison is line-based. Each side can hold up to 50,000 lines and 5 MB; larger texts get a message instead of a result. Big comparisons run in a background worker so the page stays usable. Texts that are almost completely different may be compared approximately: the result is then valid but not always the shortest possible, and the page says so. A moved line or word is shown as removed in one place and added in another; the tool does not detect moves. Highlighting inside lines is skipped for very long lines. Copy diff gives you the marked lines as plain text.
Example
Compare these two versions of a small function:
Original:
function greet(name) {
console.log("Hello, " + name);
return true;
}
Changed:
function greet(name, punctuation = "!") {
console.log("Hello, " + name + punctuation);
return true;
}
greet("world");The unified result shows the two changed lines as a removal followed by an addition, keeps the unchanged lines, and adds the two new lines at the end:
- function greet(name) {
- console.log("Hello, " + name);
+ function greet(name, punctuation = "!") {
+ console.log("Hello, " + name + punctuation);
return true;
}
+
+ greet("world");The summary reads 4 lines added, 2 removed and 3 unchanged. It also groups the changes as 2 added lines and 2 changed lines, because a removed line and an added line next to each other count as one change. Turn on “Highlight changes inside lines” to see which words or characters changed within a line.
Frequently asked questions
What do the options for whitespace and case do?
Ignore whitespace treats runs of spaces and tabs as equal, Ignore case compares lines without regard to capital letters, and Ignore blank lines leaves empty lines out of the comparison and the result.
Can I compare files?
Yes. You can open a file for each side or drop a text file of up to 5 MB onto a box. Files are read in your browser and never uploaded.
How do I compare JSON?
Use the JSON Diff, which compares values and ignores formatting and key order.
Is my text uploaded?
No. The comparison runs in your browser.
Privacy
This tool runs entirely in your browser. What you enter is processed on your device and is not sent to a server.