Compare text (diff checker)
Compare two text versions by line, word or character locally. Whitespace and case options can hide differences.
Runs entirely in your browser
Line comparison handles about 10,000 lines per side. Word and character comparison is limited to about 300,000 characters in total.
How to compare two texts
- Paste the original into the left box and the changed version into the right box.
- Choose whether to compare by lines, words or characters, and side by side or inline.
- Press Compare. Additions are marked with a plus on a green tint; removals are struck through on a grey tint.
How the comparison works
A diff finds the shortest list of edits that turns the original into the changed text. Matching stretches are left alone; what is left over is shown as removed from the original and added in the new version. This tool uses the open-source jsdiff library, which runs in your browser.
When a block of lines is replaced, the old and new versions are shown on the same rows in side-by-side view so you can read them across. On a phone the two sides stack. "Open a .txt file" fills whichever box you used last.
Tips
- Compare lists after cleaning them with Remove duplicate lines.
- Make the same edit everywhere first with Find and replace.
- Comparing two data exports? Convert them first with JSON to CSV so each record sits on one line.
- Press Swap to see the comparison the other way round.
Run this job in code with the paid API. Compare text (diff checker) API.
Questions
Which comparison should I choose?
Lines is best for code, lists and configuration files and is the fastest. Words suits prose, where a small edit would otherwise mark a whole line as changed. Characters shows the smallest edits, such as a changed digit or a typo.
How are changes marked?
Added text has a plus sign and a green tint. Removed text has a minus sign, a grey tint and a line through it. The sign is there so the difference does not rely on colour alone.
What do Ignore case and Ignore spaces do?
Ignore case treats upper and lower case as equal. Ignore spaces (line mode only) disregards differences in spaces and tabs inside and around lines.
How big a file can I compare?
About 10,000 lines on each side works comfortably when the texts are mostly alike. Two long texts that are completely different take much longer, and the comparison gives up with a message after a while.