How to compare two texts
- Paste the earlier version into Original text on the left and the newer version into Changed text on the right.
- Choose Lines or Words. The comparison runs automatically a moment after you stop typing; Compare runs it immediately.
- Read the summary line, for example 2 lines added, 1 line removed, then scroll through the highlighted result. If nothing differs, you'll see No differences found.
Reading the result
In Lines mode the result is a table. The first number column is the line number in the original, the second is the line number in the changed text, and the sign column shows − for a removed line (red) or + for an added line (green). Unchanged lines show both numbers. A line that was edited appears as a removal followed by an addition, because at line level an edit is a pair of the two.
In Words mode the changed text is shown as running prose, with removed words struck through in red and added words in green, right where they occur. Text is split into words, single punctuation marks and runs of whitespace. Changes that consist only of whitespace are highlighted but not counted in the summary.
Lines or words?
- Use Lines for source code, configuration files, CSV data, lists and anything else where each line is a unit of meaning.
- Use Words for prose – contracts, essays, articles, translations under review – where a long paragraph is a single line and a one-word edit would otherwise mark the whole paragraph as changed.
Ignore case and Ignore whitespace
Ignore case treats “Hello World” and “hello world” as equal. Ignore whitespace works a little differently in each mode. In Lines mode, all whitespace is removed from both lines before they are compared, so indentation, trailing spaces and spacing inside the line are ignored – including the difference between ab and a b. In Words mode, any run of spaces, tabs or line breaks counts as equal to any other, so text that was only re-wrapped is reported as unchanged.
Examples
A configuration change. The original is host=localhost, port=8080, debug=true on three lines; the changed version alters the port to 9090 and adds timeout=30 at the end. Lines mode shows line 2 removed, a new line 2 added and a new line 4 added: 2 lines added, 1 line removed.
An edited sentence. Comparing “The quick brown fox jumps over the lazy dog.” with “The quick red fox leaped over the lazy dog.” in Words mode highlights brown → red and jumps → leaped: 2 words added, 2 removed. In Lines mode the same pair is simply one line removed and one added.
A contract clause. “The payment is due within 30 days.” against “The payment is due within 14 days.” in Words mode pinpoints the single changed figure, which is easy to miss when reading two versions side by side.
Reformatted code. if (x == 1) { versus if (x==1) { with different indentation on the next line shows two lines changed. Tick Ignore whitespace and the result becomes No differences found.
How the comparison works
The tool uses the Myers difference algorithm, published by Eugene W. Myers in 1986 and still the default in Git. It finds a shortest edit script: the smallest number of line or word insertions and deletions that turn the original into the changed text. Lines or words common to the start and end of both texts are matched first, so only the section in between needs the full search. If that section needs more than 2,000 insertions and deletions, the tool stops searching, to keep your browser responsive, and shows the whole middle section as removed and then added.
Because the result is the shortest edit, not a record of what the author actually did, a moved paragraph appears as a deletion in one place and an insertion in another. There is no separate “moved” marker.
Tips for cleaner comparisons
- Comparing two JSON files? Run both through the JSON Formatter with the same indentation and Sort keys on, so formatting and key order don't show up as changes.
- Comparing two lists whose order doesn't matter? Sort both with Sort Lines first; the diff then shows only items that were added or are missing.
- If one version came from a PDF with broken lines, join its lines with Remove Line Breaks, or use Words mode with Ignore whitespace.
- In Words mode, Chinese and Japanese text has no spaces, so everything between two punctuation marks counts as one “word”. A one-character change highlights that whole phrase.
FAQ
Are my texts uploaded?
No. Both texts stay in the page and the comparison runs on your own device, which is what you want for unpublished contracts, private correspondence or proprietary source code.
Can I compare Word documents or PDFs?
Copy the text out of each file and paste it into the two boxes. Formatting such as bold or font changes is not compared, only the text itself.
Why is a whole paragraph marked as changed?
In Lines mode, a paragraph is one line, so any edit inside it changes the whole line. Switch to Words mode to see the exact words.
Is there a size limit?
There is no fixed text size limit. Very different texts are capped at 2,000 changes in the differing section, as described above; texts that share most of their content can be long.