How to compare two texts
- Paste the earlier version into Original text and the newer one into Modified text, or use Open file under each box to load a text file. Sample texts are loaded so you can see a result straight away.
- The comparison runs as you type. For very large texts, press Compare to run it.
- Choose Line to highlight whole changed lines, or Word to also mark the changed words inside a line. Switch between Side by side and Unified view.
- Tick Ignore whitespace to skip differences in spaces and tabs, Ignore case to treat Hello and hello as equal, and Hide unchanged lines to show only the changes with three lines of context.
- Press Swap texts to reverse the direction, and Copy diff to copy the result as text with
-for removed lines and+for added lines.
How the comparison works
The tool splits both texts into lines and finds the smallest set of added and removed lines that turns one into the other. It uses Myers' difference algorithm, the default method of git diff. Lines that sit in the same order in both texts are unchanged, and everything else is a deletion or an addition. In Word mode, each deleted line is paired with the added line next to it, and the same algorithm then runs on their words and punctuation to mark the exact edit.
Worked example
The default texts are a four-line invoice note and an edited five-line version. The summary reads "1 deletion, 2 additions, 3 unchanged lines".
- Line 2 changed from "Payment is due within 30 days of the invoice date." to the same sentence with 45 days. Word mode highlights only
30in the removed line and45in the added line. - "A 2% discount applies if paid within 10 days." is a new line, so it appears as an addition with no partner.
- "Invoice 1042", the late fee line and the questions line are identical and are not colored.
Limits and edge cases
- A line break at the very end of a text is ignored, and Windows (CRLF), Mac and Unix line endings count as the same.
- A paragraph that moved is shown as removed from one place and added in another, because a line diff has no concept of moving.
- Each text can have up to 100,000 lines. If the comparison takes more than three seconds, the part that could not be matched is shown as one replaced block and the summary says so.
- Word highlights are skipped for lines over 5,000 characters or when two lines share very little. Those lines are shown as whole replaced lines.
- Text only: files are read as UTF-8 text, up to 10 MB each. Images and office documents will not compare.
Frequently asked questions
How do I compare two text files online?
Open each file with the Open file button under the matching box, or paste their contents. The comparison happens in your browser and the text is not uploaded, so it works for private drafts and config files.
What do the red and green lines mean?
Red lines with a minus sign exist only in the original text. Green lines with a plus sign exist only in the modified text. Lines without a color are the same in both.
Can I ignore spaces or capitalization when comparing?
Yes. Tick Ignore whitespace to treat runs of spaces and tabs as equal and to ignore spaces at the start and end of a line. Tick Ignore case to treat upper and lower case letters as the same.
Why does a moved paragraph show as deleted and added?
A diff compares texts in order, so it cannot tell that a block moved. It reports the lines that disappeared from the old position and the lines that appeared in the new one.
Need to combine two versions into one? Use the text diff merger to accept or reject each change. To compare JSON, run both documents through the JSON formatter first so each key sits on its own line, and to tidy a list before comparing, try the line sorter.