Text diff checker
Paste one text in each field and the tool compares them line by line: it shows what is identical, what was added and what was removed, with the line number in each text. Everything happens in your browser — not one character you type is sent to a server.
A detail that catches people: a trailing space is a difference. “word ” is not the same as “word”. It sounds trivial until you need it — this is exactly what hunts the phantom diff in your editor, the file that shows as modified after you merely opened it, because saving added or removed a space at the end of a line.
The comparison has a declared limit: the matrix that solves the problem fits in at most 2 million cells, which in practice means texts that share very little, roughly 1,400 fully different lines on each side. Before the matrix runs, identical leading and trailing sections are cut for free, so two similar files with one change in the middle fit comfortably even with thousands of lines. Past the limit the page tells you, instead of freezing the tab.
How to use
- Paste the original text in the left field — the older version, the one in the repository, the reference you want to compare against.
- Paste the compared text in the right field — the newer version, the result you want to check.
- Read the three counters at the top: lines added, lines removed, lines unchanged. Lines marked in red were dropped from the original; green ones were introduced by the compared text.
- If you need the result somewhere else, press copy: it leaves line by line, with each side’s number and the addition or removal sign, ready to paste into a terminal or an editor.
What the comparator counts as a line
Normalization comes first: CRLF (the Windows end-of-line) and a bare CR become LF before any counting. A file saved on Windows and opened on Linux shows no difference at all if the content matches.
Then both ends are trimmed: the identical prefix and suffix of the two texts are cut out without entering the matrix — they are equal by construction. Only the differing middle goes through the computation, which is what makes long files with one isolated change cheap to compare.
In that middle section the tool finds the longest common subsequence of lines: the largest set of lines appearing in the same order on both sides. Those come out as unchanged; the rest becomes removal or addition. Inside an altered block, removed lines are listed before added ones.
A blank line is a counted line: between two consecutive line breaks there is an empty line, and it shows up in the result with its number like any other. The file’s final newline counts too — text ending with a line break has one empty line more than the same text without it.
| Case | What the tool does | Why |
|---|---|---|
| “a ” against “a” | 1 removed and 1 added | A trailing space changes the line’s text; comparison is exact. |
| “a\r\n” against “a\n” | No difference | CRLF is normalized to LF before comparing. |
| Empty field against a text | Everything on one side only | Adding a whole text to an empty field is pure addition, not an error. |
| 3,000 lines swapped for other 3,000 | Refused with a named warning | The comparison matrix would exceed 2 million cells; a warning beats a frozen tab. |