Diff checker (compare two texts)
A diff lists the smallest set of lines added and removed to turn one text into another. Paste the original and the changed version to see each change line by line, with the changed words inside a line marked, all in your browser.
Differences
2 changes
3 added, 2 removed, 3 unchanged lines
Differences, unified style
@@ -1,5 +1,6 @@
Order #1042 for Priya
- Items: 2 masala dosa, [-1-] filter coffee
- Total: ₹[-240-]
+ Items: 2 masala dosa, {+2+} filter coffee
+ Total: ₹{+280+}
Pay by: UPI
+ Note: ring the bell
Deliver to: 12 MG Road, Bengaluru- Lines added
- 3
- Lines removed
- 2
- Lines unchanged
- 3
- Lines in each text
- 5 → 6
- Changed lines marked word by word
- 2[-removed-] and {+added+} inside the line
| Change | Original lines | Changed lines | Lines |
|---|---|---|---|
| 1 | 2–3 | 2–3 | 2 removed, 2 added |
| 2 | none (after 4) | 5 | 1 added |
- In a pair of changed lines, [-…-] marks what was removed from the original line and {+…+} what was added in the changed one, the delimiters git diff --word-diff=plain uses. Pairs that share less than half their words are shown whole.
How does a diff checker find the differences?
A diff is the shortest list of lines to remove and add that turns one text into the other; everything else is the lines they have in common. Eugene Myers showed in 1986 that finding the longest common subsequence of two sequences and finding the shortest edit script are dual problems, and gave an algorithm that takes O(ND) time, where N is the total length of both texts and D the number of edits, so it is fast when the texts are similar.
This checker splits both texts into lines (or into words), gives each distinct line a number, trims the lines that match at the start and end, and runs Myers' algorithm with his linear-space refinement, which meets in the middle from both ends. Where removed and added lines sit together, the removed ones are listed first. When a removed line and an added line share at least half their words, they are compared again word by word, and the words that differ are wrapped in [-…-] in the removed line and {+…+} in the added one.
The output follows the unified format from GNU diff: lines common to both texts start with a space, removed lines with -, added lines with +, and each group starts with a hunk header such as @@ -2,3 +2,4 @@, meaning 3 lines from line 2 of the original and 4 from line 2 of the changed text. Like diff -u, it shows three unchanged lines around each change by default. It puts a space after each + and - and can mark words, so it is made for reading; to make a patch for the patch or git apply commands, run diff -u or git diff instead.
Line endings are ignored, so a Windows (CRLF) file compares cleanly with a Unix one, and a note says when they differ. Ignoring whitespace treats runs of spaces and tabs as one space and ignores them at the start and end of a line; ignoring case treats A and a as the same. Everything runs in your browser, and if two texts differ in so many places that comparing them would hang the page, it stops and asks you to compare a smaller part.
unchanged line (starts with two spaces)
- removed line (only in the original)
+ added line (only in the changed text)
@@ -2,3 +2,4 @@ 3 lines from line 2 of the original, 4 from line 2 of the changed text
- Total: ₹[-240-]
+ Total: ₹{+280+} [-…-] removed and {+…+} added inside a changed lineHow do you read a diff?
| Prefix | Diff line | Original line | Changed line | What it means |
|---|---|---|---|---|
| @@ | @@ -1,4 +1,4 @@ | 1–4 | 1–4 | Hunk header: 4 lines from line 1 of the original, 4 from line 1 of the changed text |
| (space) | Pay by: UPI | 1 | 1 | Unchanged |
| - | Total: ₹[-240-] | 2 | — | Removed from the original; [-…-] is the part that was removed |
| - | Deliver today | 3 | — | Removed from the original |
| + | Total: ₹{+280+} | — | 2 | Added in the changed text; {+…+} is the part that replaced it |
| (space) | Leave at the door | 4 | 3 | Unchanged |
| + | Ring the bell | — | 4 | Added in the changed text |
How to compare two texts and find the differences
- 1Paste both versionsPut the original in the first box and the changed version in the second, up to 200,000 characters each. Nothing is sent anywhere.
- 2Choose how to compareCompare by line for code, configuration and lists, or by word for prose and long lines. Tick the boxes to ignore whitespace or capital letters.
- 3Read the changesLines starting with - were removed and lines starting with + were added; inside a changed line, [-…-] and {+…+} show the exact words. The table gives the line numbers of every change.
- 4Copy or download the diffCopy the output or download it as changes.diff to share it or keep it with your notes.
Frequently asked questions
What do the + and - signs in a diff mean?
What does [-old-]{+new+} mean in a diff?
Why does git diff sometimes show a change differently from another diff tool?
How do I compare two texts while ignoring spaces or capital letters?
Why does every line show up as changed when I compare two files?
Sources
- Eugene W. Myers, An O(ND) difference algorithm and its variations, Algorithmica 1, 251–266 (1986) (checked 20 Oct 2026)
- GNU diffutils manual, Unified Format (-u; three lines of context by default) (checked 20 Oct 2026)
- GNU diffutils manual, Detailed Description of Unified Format (hunk headers, line prefixes) (checked 20 Oct 2026)
- GNU diffutils manual, Incomplete Lines (“\ No newline at end of file”) (checked 20 Oct 2026)
- git-diff documentation (--diff-algorithm: Myers is the default; --word-diff=plain delimiters, not escaped) (checked 20 Oct 2026)
- git documentation, Generating patch text with -p (the traditional unified format's -, + and space prefixes) (checked 20 Oct 2026)
Need a custom dev tool for your team?
We build internal tools, dashboards, APIs, and SaaS platforms. If you can describe it, we can ship it.
Built by CountryDevs · No signup · No ads · We count visits, never what you enter