About Text Diff Checker
This diff checker splits two texts into lines and reports which lines are in both, which exist only in the original, and which exist only in the changed version. A line that was edited shows up as one removed line followed by one added line. Matching uses the longest common subsequence of lines, so inserting a line near the top does not throw every later line out of step. Two tick boxes control what counts as equal: Ignore letter case, and Ignore leading/trailing spaces, which is on by default so indentation changes do not flood the result. Both texts stay in your browser.
How to read the line by line comparison
| Marker | Meaning | Number shown in the Line column |
|---|---|---|
| = | The line is in both texts | Its line number in Original |
| Minus sign | The line is only in Original (removed) | Its line number in Original |
| Plus sign | The line is only in Changed (added) | Its line number in Changed |
Unchanged lines are printed as they appear in Original, so when case or spaces are ignored you see the original's capitalisation and indentation.
Line difference examples
Each result is what the tool reports with its default options unless stated.
One value changed in a config file
Original: timeout=30 / retries=3 / debug=false. Changed: timeout=30 / retries=5 / debug=false.
Added lines 1, Removed lines 1, Unchanged lines 2. Line 2 is listed twice: minus retries=3, then plus retries=5.
A line inserted in the middle
Original: apples / bananas / cherries. Changed: apples / blueberries / bananas / cherries.
Added lines 1, Removed lines 0, Unchanged lines 3. Only blueberries is marked with a plus; bananas and cherries still match.
A line deleted
Original: apples / bananas / cherries. Changed: apples / cherries.
Added lines 0, Removed lines 1, Unchanged lines 2. bananas is marked with a minus at line 2.
A line moved to the top
Original: one / two / three. Changed: three / one / two.
Added lines 1, Removed lines 1, Unchanged lines 2. three appears with a plus at line 1 and with a minus at line 3.
One word changed in a sentence
Original: The quick brown fox. Changed: The quick red fox.
Added lines 1, Removed lines 1, Unchanged lines 0. The whole line is shown as removed and added.
To narrow a change inside a long paragraph, break both texts into one sentence per line before comparing.
Differences in case and indentation only
Original: Hello World / (two spaces)indented. Changed: hello world / indented.
Default options: Added 1, Removed 1, Unchanged 1, Identical No. With Ignore letter case ticked as well: Unchanged 2, Identical Yes.
What the two ignore options change
| Situation | Ignore leading/trailing spaces on | Ignore leading/trailing spaces off |
|---|---|---|
| Same line with different indentation | Equal | Different |
| Trailing spaces or tabs at the end of a line | Equal | Different |
| Windows (CRLF) line endings against Unix (LF) | Equal | Every line that ends in a line break differs |
| Two words separated by one space against two spaces | Different | Different |
| One text ends with a final line break, the other does not | One removed or added empty line | One removed or added empty line |
Ignore letter case is separate: with it ticked, Hello World and hello world are equal. Neither option changes spacing inside a line, so collapse repeated spaces first if those should not count.
How the diff decides which lines match
The tool finds the longest common subsequence of the two texts: the largest set of lines that appear in both, in the same order. Those lines are the unchanged ones. Any line of the original outside that set is reported as removed, and any line of the changed text outside it is reported as added.
This is why an insertion costs one line and not the rest of the file. A comparison that only checked line 1 against line 1 and line 2 against line 2 would mark everything after an inserted line as different.
The method builds a table with one cell for every pairing of an original line with a changed line. Two texts of 5,000 lines each need 25 million cells, so very large files can be slow in a browser tab. For those, a command-line diff is the better choice.
Command-line ways to diff lines
If the files are already on disk, these standard commands do the same job.
| Command | What it does |
|---|---|
| diff -u old.txt new.txt | Unified diff with minus and plus lines (Linux, macOS) |
| diff -i old.txt new.txt | Ignores differences in letter case |
| diff -w old.txt new.txt | Ignores all white space when comparing lines |
| git diff --no-index old.txt new.txt | Git's diff for two files outside a repository |
| fc old.txt new.txt | File compare in the Windows command prompt |
| Compare-Object (Get-Content old.txt) (Get-Content new.txt) | Lists differing lines in PowerShell |
How to use it
- 1
Paste the earlier version into Original.
- 2
Paste the newer version into Changed.
- 3
Keep Ignore leading/trailing spaces ticked to treat lines that differ only in indentation or trailing blanks as equal, or untick it for an exact check.
- 4
Tick Ignore letter case if capitalisation should not count as a difference.
- 5
Read the Differences counts, then go down the Line by line table: = is unchanged, a minus sign is a line only in Original, a plus sign is a line only in Changed.