Text Diff Checker
Compare two texts side by side and see exactly what changed. Highlights additions, deletions, and unchanged lines.
Paste two versions of text to see additions (green) and deletions (red) highlighted line by line.
Both texts are compared in your browser, nothing is uploaded.
What Is a Text Diff and Why Developers Use It Daily
A diff (short for "difference") shows you exactly what changed between two pieces of text. Added lines, deleted lines, and modified lines, all highlighted clearly so you don't have to squint at two versions side by side. It's the foundation of every code review, every version control system, and every "track changes" feature.
Git uses diffs internally to track every change you've ever made. When you run "git diff", you see the same kind of output this tool generates. Code review tools like GitHub and GitLab display diffs to help teams review changes before they're merged.
This tool isn't just for code. Compare two versions of a contract, spot differences in API responses, verify config file changes, or check if two "identical" texts are actually identical. Paste the original on the left, the modified version on the right, and see every difference instantly.
Diff Algorithms Compared
| Algorithm | How It Works | Best For |
|---|---|---|
| Line-by-line | Compares entire lines as units | Code files, config files, structured text |
| Word-by-word | Compares individual words within lines | Prose, documentation, content changes |
| Character-by-character | Compares every single character | Finding typos, subtle whitespace differences |
| Myers (Git default) | Finds shortest edit distance between texts | General purpose, produces minimal diffs |
| Patience | Matches unique lines first, then fills gaps | Code with many similar lines (HTML, CSV) |
What this means for you: This tool uses a line-level diff built on the Longest Common Subsequence approach, the same granularity Git shows by default, which keeps code and config comparisons readable. To spot a subtle change within a line, split or format the text so the change lands on its own line before comparing.
Practical Uses for Text Diffs
Comparing API responses
Getting different results from an API call? Paste both responses and see exactly which fields changed. Great for debugging staging vs production differences.
Verifying config changes
Before deploying a config change, diff the old and new versions. This catches accidental modifications, a misplaced comma in JSON or a typo in a database connection string.
Document version comparison
Compare two versions of a legal document, specification, or email draft. The diff highlights the lines that were added, removed, or changed, so you can see what differs at a glance.
Finding hidden characters
Two strings look identical but aren't equal? A diff can reveal invisible differences: trailing spaces, tab-vs-space issues, different line endings (CRLF vs LF), or zero-width characters.
Understanding Diff Output
| Indicator | Meaning | What To Look For |
|---|---|---|
| + Added (green) | Text exists in the new version but not the old | New features, additions, expansions |
| - Removed (red) | Text existed in the old version but was deleted | Deleted code, removed features |
| Changed line | Shows as a red removed line plus a green added line | An edit is a delete plus an add |
| Unchanged | Identical in both versions | Context, helps you orient yourself |
How This Tool Compares Text
Both texts are split into lines, then matched with a Longest Common Subsequence algorithm, the classic approach behind most diff tools. Lines that appear in both versions are marked unchanged; lines only in the modified text are additions; lines only in the original are deletions.
There is no separate "modified" marker. When a line is edited, the old version shows as a red deletion and the new version as a green addition, sitting next to each other. Reading the pair together tells you what changed.
Whitespace counts. A line with a trailing space is different from one without, and Windows line endings (CRLF) differ from Unix ones (LF). That strictness is what makes the tool useful for hunting invisible differences, but for prose where spacing does not matter, trim your text first. The summary at the top tallies how many lines were added, removed, and left unchanged.
Reading a Diff: A Worked Example
Say you tweak a small config block. Here are the two versions and the diff the tool produces.
const port = 3000; const host = "localhost"; app.listen(port);
const port = 8080; const host = "localhost"; app.listen(port, host);
- const port = 3000; + const port = 8080; const host = "localhost"; - app.listen(port); + app.listen(port, host);
The unchanged middle line anchors the comparison, and each edited line appears as a delete followed by an add. The summary would read two added, two removed, one unchanged.
What a Line Diff Will and Will Not Catch
A line-level diff is fast and readable, but it helps to know its blind spots so you can read the output with the right expectations.
It catches
Added and removed lines, edited lines (as a delete plus an add), and invisible differences such as trailing spaces, mixed tabs and spaces, and CRLF versus LF line endings.
It will not tell you
Exactly which characters changed inside a line (the whole line is flagged), and it does not recognise a moved block as a move, so a paragraph shifted up or down shows as a deletion in one place and an addition in another.
None of this is a fault, it is how line diffs work everywhere, including Git. When you need to see a within-line edit, split the line so the change sits on its own row before comparing.
Tips for Cleaner Diffs
- Format JSON first. Pretty-print both sides so every key sits on its own line, then a one-field change shows as a single line rather than one giant line marked as different.
- Normalise line endings. If a whole file shows as changed for no obvious reason, mismatched CRLF and LF endings are the usual cause. Convert both to the same style first.
- Trim prose before comparing. For documents where spacing is not meaningful, remove trailing spaces so real wording changes stand out instead of whitespace noise.
- Sort keys or lines when order does not matter. Comparing two lists that hold the same items in a different order? Sort both first so the diff shows genuine differences, not reordering.
Related Tools
How to use this tool
Paste the original text in the left box
Paste the modified text in the right box
Click Compare to see additions, deletions, and unchanged lines
Common uses
- Comparing API response versions during debugging
- Reviewing config file changes before deployment
- Checking document revisions for content differences
- Finding hidden character differences in strings
Share this tool
Frequently Asked Questions
How does the diff checker work?
Is my text sent to a server?
Can it compare code?
Does it handle large files?
Can I find invisible character differences?
What's the difference between this and Git diff?
Can I compare JSON responses?
How do I read the diff output?
Does it do word-level or character-level diff?
Can I compare database query results?
What about whitespace differences?
Can I save or share the diff result?
Results are for general informational purposes only and should be checked before use. They are not professional advice. See our Disclaimer and Terms of Service.