Text Diff
Compare two blocks of text line by line, with inline highlighting
Comparison options
When on, trailing spaces and CRLF/LF differences are not counted as changes.
Comparison result
Both sides are empty — paste some text to compare first
Last updated: 2026-10-11
About this tool
Text comparison (usually called a diff) answers a simple question: of two blocks of text that look nearly identical, what actually changed? This tool compares line by line using a longest-common-subsequence algorithm, so it can tell "one line was inserted" apart from "everything after this point changed" — something a naive index-by-index comparison gets wrong. Results can be viewed side by side or in a unified view, and modified lines get character-level highlighting so you can see exactly which characters moved. Everything runs in your browser, so code, config files and logs are safe to paste.
Features
Accurate line-level diff
Built on a longest-common-subsequence algorithm, it recognises real insertions and deletions. Inserting one line in the middle will not mark every following line as changed.
Inline character highlighting
Modified lines are compared at the character level, so only the parts that actually changed are highlighted instead of the whole line.
Two switchable views
Side-by-side is best for checking line by line; the unified view is best for skimming overall changes. Deleted and added lines are paired so columns stay aligned.
Ignore whitespace and case
Trailing spaces, CRLF vs LF differences and case can all be ignored, so you do not drown in spurious changes.
Safety guardrails
Up to 5,000 lines per side. Larger inputs are downgraded to a coarse comparison — the page will never freeze, even at the cost of detail.
Diff summary
Added, removed and unchanged line counts plus a similarity score, so you can judge the scale of a change at a glance.
How to use
- 1
Paste the original
Put the before version into the left box.
- 2
Paste the changed version
Put the after version into the right box; results update live.
- 3
Pick a view and options
Switch between side-by-side and unified. If you see lots of spurious changes, turn on "ignore leading/trailing whitespace" or "ignore case".
- 4
Read the result
Added lines are green, removed lines red, and modified lines show inline character highlighting. The summary at the top gives the overall picture.
Options
- View
- Side by side for line-by-line checking, or unified for continuous reading.
- Ignore leading/trailing whitespace
- On by default. Ignores trailing spaces and CRLF/LF differences, avoiding changes introduced by editor auto-formatting.
- Ignore case
- Off by default. When on, "Apple" and "apple" are treated as equal.
Common use cases
- Comparing two config files to confirm only the intended fields changed before deploying
- Reviewing the difference between two commits (just paste the output of git diff)
- Comparing two contract drafts or copy revisions character by character
- Checking whether an API response changed after a release
FAQ
Questions you may have about this tool
Is my text uploaded anywhere?
No. The comparison runs entirely in your browser and pasted content produces no network requests. You can confirm this in your browser developer tools network panel; the page even keeps working with the network disconnected.
Why are the lines after an insertion not all marked as changed?
That is exactly the difference from a naive index-by-index comparison. This tool uses a longest-common-subsequence algorithm, so it recognises that a single line was inserted rather than that everything after it changed. Only the genuinely new line is marked.
How do I get rid of diffs caused by trailing spaces?
Keep "ignore leading/trailing whitespace" enabled. It ignores both trailing spaces and CRLF/LF differences, the two most common sources of false positives. Turn it off if whitespace changes genuinely matter to you.
How much text can I compare?
Up to 5,000 lines per side. Exceeding that gives you a clear message rather than silently truncating — silent truncation could make you miss real differences, which is worse than an error.
Why are a removed line and an added line paired on the same row?
It is intentional alignment. Pairing adjacent removals and additions keeps the left and right sides lined up; making each its own row would leave them visually mismatched.
Can I compare JSON or code?
Yes. It treats everything as plain text lines and does not care about the format. For JSON, format it first so the indentation is consistent — the diff will be much cleaner.
How is the similarity score calculated?
Similarity = unchanged lines ÷ line count of the longer side. Two identical texts score 100%; two completely different texts of equal length score 0%.
Does it handle Chinese and emoji?
Yes. Character-level comparison works on Unicode code points, so Chinese characters, emoji and CJK extension characters are never split in half.