Text Compare & Diff Checker
Compare two texts or files and see every added, removed and changed line, word or character.
Paste, type or open two texts to see what changed.
Paste or open two versions of a text and see what changed between them: lines removed, lines added, and inside a changed line the exact words or characters that differ. It suits drafts and contracts as much as code and configuration files, and the result updates as you type.
The comparison runs in your browser, and neither text is sent anywhere. There is no account and no share link, so a private document stays on your device.
Options
- View — side by side, or unified, where each block of removed lines sits above the lines that replace it. Each column is headed by its file's name, or Original and Changed for typed text. On a narrow screen only the unified view is offered.
- Highlight — inside a changed line, mark the words that differ (the default), single characters, or nothing beyond the whole line. Words are found with the browser's own word rules, so Hindi, Thai, Chinese and Japanese text splits into real words. A word replaced by a close spelling of itself, such as a typo or a renamed variable, gets a light mark with its changed letters marked more strongly. Spaces and tabs at the edge of a marked change show as · and →, so a change that is only whitespace is still visible.
- Ignore whitespace — none, spaces and tabs at the start and end of each line, or all whitespace.
- Ignore case — capital and small letters count as the same, including ß and ss.
- Ignore blank lines — empty lines, and lines holding only spaces, are left out of the comparison and shown as unchanged.
- Ignore line endings — on by default: Windows (CRLF), Unix (LF) and old Mac (CR) line endings count as the same.
- Hide unchanged lines — on by default: long runs of unchanged lines fold away, keeping the number of context lines you choose (3 by default, up to 20) around each change. Select a fold to show its lines.
- Moving between changes — the arrow buttons above the comparison, or Alt+↓ and Alt+↑ when you are not typing in a box, step from one changed place to the next and mark it with a bar on its left.
- Wrap long lines — on by default: long lines wrap in the two text boxes, which then show no line numbers. Turn it off for code to number the lines in the boxes. The comparison below always wraps and numbers its lines.
The options are remembered on this device, and Reset options puts them back to their defaults.
The ignore options change what the view counts as a change. They never change the patch, which always records every difference, so applying it rebuilds the changed text exactly.
Each text can be up to 2 MB and 50,000 lines. Open a file with its Open file button, or drop it on the box; it is read as UTF-8 or, when it starts with a byte order mark, UTF-16.
How the comparison works
The two texts are split into lines and compared with the Myers diff algorithm, which finds the fewest lines to remove and add to turn one text into the other. Within each block of removed and added lines, a removed line is paired with the most similar added line, judged by the word pairs they share, so a reworded sentence shows as one changed line rather than a deletion and an insertion. The paired lines are then compared word by word, or character by character, to mark exactly what differs.
Where the texts are very large and very different, the full alignment would take too long. The tool then shows everything between the matching start and end as one changed block, and says so.
Text typed or pasted into the boxes always has Unix line endings, because browsers store it that way. Line ending differences therefore show only between opened files.
Examples
A reworded sentence
- Original text
The meeting is on Monday at 10 am in room 4. Please bring the report.
- Changed text
The meeting is on Tuesday at 11 am in room 4. Please bring the report.
- Result
- 1 line changed in 1 place
- Marked
- Monday … 0 → Tuesday … 1
With the default options, the first line is paired with its new version and only the day and the time are marked, not the whole sentence.
A code edit, with its patch
- Original text
function total(items) { let sum = 0; for (const item of items) sum += item.price; return sum; }- Changed text
function total(items, tax) { let sum = 0; for (const item of items) sum += item.price; return sum * (1 + tax); }- Result
- 2 lines changed in 2 places
- Patch
--- Original +++ Changed @@ -1,5 +1,5 @@ -function total(items) { +function total(items, tax) { let sum = 0; for (const item of items) sum += item.price; - return sum; + return sum * (1 + tax); }
The patch lists each change with 3 lines of context: lines starting with - are removed, and with + added.
Indentation only
- Original text
<ul> <li>One</li> <li>Two</li> </ul>
- Changed text
<ul> <li>One</li> <li>Two</li> </ul>
- With the default options
- 2 lines changed in 1 place
- Ignore whitespace: Leading and trailing
- No differences in 4 lines
Re-indented code shows every indented line as changed until leading whitespace is ignored.
Frequently asked questions
diff -u writes. Saved as a file, it can be applied to the original with patch original.txt changes.diff to produce the changed version, or attached to a bug report or code review to show exactly what changed.See also
- Invisible Character Remover — to find and remove hidden characters that make texts differ.
- Remove Extra Spaces — to clean up spacing before comparing.
- JSON Compare — to compare two JSON documents by meaning, ignoring key order and layout.