Text Diff Checker
Compare text and highlight every line and word change — free, private and running entirely in your browser
Compare two pasted or opened texts and download a unified patch. Original text and Changed text each take a paste, a drop, or Open. Nothing is sent anywhere.
Last updated: 11 October 2026
Guide, examples, and FAQ
About Text Diff
What it does
The diff library 9.0.0 compares lines. A removed block immediately followed by an added block is paired line by line as modified lines. Inside each modified line, a word-level diff marks the words that changed. Ignore case applies to that word diff. Ignore whitespace does not: it only trims the start and end of a line before the line match.
Who it is for
For two copies of plain text — a note, a config, or a source file — when you want the line counts and a .diff file.
When to use it
Use it after both panes have text. PDF and Word files belong on Document Diff. This page reads a file as text and does not extract those formats.
Key features
Two panes
Original text and Changed text. Paste, drop a file, or Open. The picker accepts .txt, .md, .log, .json, .xml, .csv, .yaml, .yml, .tsv, .html, .css, .js, .ts, .tsx, .jsx, or any text file. Each pane shows lines and characters. Swap exchanges the panes. Clear resets them. Compare is disabled when both are empty.
Options
On the comparison: Ignore whitespace off, Ignore case off, Split (Unified is the other view), Collapse unchanged on, Wrap on. Collapse unchanged keeps up to 3 unchanged lines around a change. Counters are +added, −removed, ~modified, and unchanged. “Texts are identical” appears when added, removed, and modified are all 0.
Patch and Save
Copy .diff and Download write diff.diff. Both are a unified patch with 3 lines of context, original.txt against changed.txt, using the same ignore options as the screen. Save keeps both texts, the switches, and a label with the counts, in memory for this visit. There is no share link.
How to use Text Diff
- 1Paste or open the original, then the changed text. Read the line and character counts.
- 2Press Compare. Leave the switches, or turn Ignore whitespace or Ignore case on.
- 3Read +added, −removed, ~modified, and unchanged. On a modified line, read the highlighted words.
- 4Copy .diff or Download diff.diff. Save if you want this comparison back during this visit.
Example
Before
host: localhost port: 8080 debug: false timeout: 30
After
host: localhost port: 3000 timeout: 30 retries: 2 +1 −1 ~1 2 unchanged. On the modified line, “port: ” is unchanged, 8080 is removed, and 3000 is added.
Both texts end with a newline. The patch is --- original.txt / +++ changed.txt, @@ -1,4 +1,4 @@, then host: localhost, -port: 8080, -debug: false, +port: 3000, timeout: 30, +retries: 2. The patch shows the whole port line as removed and added. The screen pairs it as one modified line and highlights only 8080 and 3000. A separate pair, “alpha” / “beta” against “alpha” / “BETA changed” / “gamma”, is @@ -1,2 +1,3 @@ with “ alpha”, “-beta”, “+BETA changed”, “+gamma”. “Hello” against “hello” is one modified line with ignore case off, and headers only with +0 −0 ~0 and 1 unchanged when ignore case is on.
Common problems and fixes
Every line looks changed
Check Ignore whitespace. Off, a leading indent or a carriage return makes the line modified. On, those trims match. A double space in the middle still does not.
The .diff file shows a whole line and the screen shows one word
The patch is a line hunk. The highlight inside a modified line is the word diff. For port: 8080 against port: 3000, the words are 8080 and 3000.
Benefits
The words, not the whole line
port: 8080 against port: 3000 is ~1. The highlight is 8080 and 3000. debug: false is the removed line. retries: 2 is the added line.
The patch follows the switches
With ignore case on, Hello against hello copies headers only: --- original.txt and +++ changed.txt, and no hunk. The screen says “Texts are identical”.
Common use cases
A config with one value changed
Compare, then read the highlighted value on the modified line before you read the .diff file.
Tips & best practices
- Ignore whitespace trims the start and end of each line, then compares. “ name: api” against “name: api” is ~1 with the switch off (the two spaces are the removed token) and unchanged with the switch on. The patch is then headers only.
- A space in the middle still counts. “timeout: 30” against “timeout: 30” stays ~1 with Ignore whitespace on, and the word diff marks the extra space. That switch is not passed to the word diff.
- A carriage return is trailing whitespace. “port: 8080” with a carriage return against the same line without one is ~1 with the switch off, and unchanged with it on.
Common mistakes to avoid
- Comparing different line endings or indentation and expecting no changes while Ignore whitespace is off. Turn it on to trim the ends of each line. It does not ignore a space in the middle.
- Reading a modified line as a full replacement. The patch may show -port: 8080 and +port: 3000. On screen only 8080 and 3000 are the marked words.
- Expecting the patch to include a change the switches hide. Copy .diff and Download use the same ignore options as the screen. Hello against hello with ignore case on has no hunk.
- Expecting a moved paragraph to stay a move. “Alpha stays first.” / “Beta moves down.” / “Gamma stays last.” against Alpha, then Gamma, then Beta is +2 −2 ~0 and 3 unchanged.
Frequently asked questions
What can I put in the two panes?
Paste text, drop a file, or Open a .txt, .md, .log, .json, .xml, .csv, .yaml, .yml, .tsv, .html, .css, .js, .ts, .tsx, .jsx, or any text file. Each pane shows lines and characters. Swap, Clear, and Compare are on that screen. Compare is disabled when both panes are empty. There is no file-size limit in the code. A very large paste depends on the browser.
What do the switches do?
They start off for whitespace and case, on for Collapse unchanged and Wrap, and the view starts as Split. Ignore whitespace trims the start and end of a line before the line match. It does not affect the word highlight. Ignore case applies to the line match and to the words inside a modified line. Collapse unchanged keeps up to 3 unchanged lines around a change.
What do the counters and the patch mean?
+added, −removed, ~modified, and unchanged. A removed block immediately followed by an added block is paired as modified lines, and the extra lines on the longer side stay added or removed. “Texts are identical” means those three counts are 0 under the current switches. Copy .diff and Download (diff.diff) are a unified patch with 3 lines of context, original.txt against changed.txt, and the same ignore options.
Is anything sent or shared?
No. Nothing is sent anywhere. There is no share link. Save keeps both texts, the switches, and a label with the counts in memory for this visit. Restore puts them back. Reloading the page clears that memory.
What does this page not do?
Plain text only. No character-level diff, no syntax highlighting, and no three-way merge. PDF and Word files are not extracted here.
When another tool fits better
- Document Diff. The files are PDF or Word. This page reads text only.
- Excel Diff. The comparison should be cells in a spreadsheet, not lines of text.
- JSON Formatter. Two JSON texts differ only by layout. Format them before comparing the lines.
Conclusion
Text Diff compares two texts and writes a unified patch. Read the highlighted words on a modified line. The patch follows Ignore whitespace and Ignore case, and a moved paragraph is removed on one side and added on the other.
Ready to try Text Diff?
Scroll back up to start now, or continue with another free diff tool.