Diff Checker
Compare two texts line by line, with character-level highlighting and the invisible differences explained.
Paste text into both boxes to compare them.
| # | Original | # | Changed |
|---|---|---|---|
| # | Line |
What changed
What It Does
This tool compares two blocks of text and shows what changed, using the same shortest-edit-script algorithm git uses — so inserting a line at the top reports one insertion rather than marking every following line as changed. Within a modified line it narrows the highlight to the characters that actually differ. It also names the invisible causes: different line endings, a missing trailing newline, or a change that is nothing but whitespace, all of which produce diffs that look wrong until someone tells you why.
When to Use It
- You have two versions of a config file and need to know precisely what differs.
- A deploy behaved differently and you want to compare the environment file against the working one.
- You are reviewing an edit someone sent back as a pasted block rather than a pull request.
- A file shows as entirely changed in git and you suspect line endings rather than content.
Worked Examples
One line inserted at the top
Reported as a single insertion. A naive line-by-line comparison would call every line changed, because everything shifted down by one — this is exactly what the Myers algorithm exists to avoid.
A one-character change
The line is marked changed, and the character-level highlight narrows it to the single digit that differs. Finding that by eye in a long connection string is genuinely hard.
Whitespace-only reindentation
Spaces became a tab. The analysis flags the change as whitespace-only, so you know a wall of red and green is a re-indent rather than a rewrite. Tick 'ignore whitespace' to confirm nothing else moved.
Identical text, different trailing newline
Invisible in any editor, and the cause of countless one-line diffs nobody can see. The analysis names it explicitly rather than leaving you staring at two lines that look the same.
Common Mistakes
- Assuming a big diff means a big change. Re-indentation, a line-ending conversion or a formatter run will mark every line as changed while altering nothing meaningful. Check the analysis before reading the diff line by line.
- Ignoring line endings. A file saved on Windows uses CRLF and one saved on macOS or Linux uses LF; the content can be byte-for-byte equivalent and still show as entirely different in git or an editor. This tool normalises them and tells you when the two sides differ.
- Missing a trailing newline difference. Whether a file ends with a newline is invisible on screen but is a real byte difference, and it makes the last line appear changed for no visible reason.
- Diffing minified or single-line files. A line diff on a file that is one enormous line can only tell you the line changed. Format both sides first — then a line diff has something to work with.
- Comparing structured data as plain text. Two JSON documents with the same content but different key order are semantically identical and textually very different. Use a structural comparison for those, not a line diff.
Features
How to Use
1. Paste the original text on the left and the changed text on the right. 2. The comparison runs as you type; use the view selector for side-by-side or unified. 3. Read the analysis first — it explains line-ending and whitespace causes before you start reading lines. 4. Tick 'ignore whitespace' if the analysis says the changes are whitespace only, to see what else moved.
Frequently Asked Questions
Embed this Diff Checker
Paste this snippet into your site to embed the tool.
Related Tools
Everything runs in your browser — neither text is uploaded, logged or stored. Line endings are normalised before comparison, so CRLF and LF versions of the same content compare as identical while the analysis still tells you they differ. Very large or almost entirely dissimilar inputs are reported as a wholesale replacement rather than a minimal diff, since computing the shortest edit script between unrelated texts costs time without telling you anything useful.