Text Compare & Diff Checker
Compare two texts or files and see every added, removed and changed line, word or character.
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. The differences are marked in the two texts themselves, so you can keep editing either one and the marks follow as you type. It suits drafts and contracts as much as code and configuration files.
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, where the two texts are editable and their lines stay level as you scroll, or unified, a read-only view where each block of removed lines sits above the lines that replace it, offered once there is text to compare. On a narrow screen, side by side shows the original above the changed text.
- Hide unchanged — on by default: long runs of unchanged lines fold away in both texts together. Select a fold to show its lines.
- Moving between changes — the arrow buttons above the comparison, or Alt+↓ and Alt+↑, also while typing in a text, step from one changed place to the next and mark it with a bar on its left.
- Copying a change across — hover over a changed place and select the arrow beside it to make the other text match it there, or, once you have moved to a change, use Copy to Changed or Copy to Original beside the navigation. The lines are copied exactly as written, whatever the options ignore. Undo (Ctrl+Z) in that text takes it back.
Ignore whitespace and Ignore case sit above the comparison beside Hide unchanged; which whitespace is ignored, Highlight, Ignore blank lines, Ignore line endings and Context lines sit under Settings, below the comparison, which counts the ones changed from their defaults:
- 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 — all whitespace, or only spaces and tabs at the start and end of each line.
- 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.
- Context lines — the unchanged lines kept around each change while Hide unchanged is on: 3 by default, up to 20.
The options are remembered on this device, and Reset beside Settings puts its options 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 text; it is read as UTF-8 or, when it starts with a byte order mark, UTF-16. Opening a file, Swap and Clear can each be undone in the text they changed.
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 has Unix line endings, and so does an opened file once you edit it, because the editor stores text that way. Line ending differences therefore show only between opened files that have not been edited.
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 with these options — the texts aren't identical
Re-indented code shows every indented line as changed until leading whitespace is ignored. Then nothing differs, and the summary says the texts still aren't identical, since the patch keeps the new indentation.
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.
- Compare PDF — to compare two PDFs, paragraph by paragraph and page by page.