Text Compare
Two texts side by side, line by line. Removed lines in red, added in green.
What is Text Compare
Text Compare puts two texts side by side and diffs them line by line: removed lines highlighted red, added lines green, with line numbers so you can see exactly which line moved. Two options change what counts as identical: ignoring whitespace collapses indent and spacing differences, and ignoring case treats Letter and letter as the same line. A unified view switches to classic - / + diff markers you can paste into a review. The engine is a longest-common-subsequence over lines, so the result is the minimal meaningful change rather than a naive block replace. Both sides are capped at 3,000 lines and everything runs in your browser — the text is never uploaded.
What this tool actually does with your file
- Where it runs
- In your browser, on this page
- Upload
- None — the file never leaves your device
- Offline
- Works with the network disconnected
Why the diff walks lines, not characters
The comparison is a longest-common-subsequence over whole lines, which is the same class of algorithm git uses. Its useful property is minimality with meaning: when you insert one paragraph, the result shows one green block — not a cascade of half-matched lines that technically differ but read as noise. Character-level diffing would be more precise on a single edited sentence, but on real documents it produces sub-line highlights that are harder to act on than the honest answer of "these three lines changed".
That is also why very large inputs are capped at 3,000 lines per side. The dynamic-programming table grows with the product of the two line counts — 3,000 by 3,000 is nine million cells, which is where the browser's budget realistically ends. Past the cap you get an error naming the counts, not a frozen tab and not a silently truncated comparison that pretends the tail did not exist.
What the two ignore options actually change
Whitespace folding collapses runs of spaces and tabs and trims the ends, so a line that was only re-indented compares as unchanged. This is the right default for prose pasted out of mail clients or exported from spreadsheets, where indentation carries no meaning — and the wrong one for Python or YAML, where indentation is the program. Case folding treats Letter and letter as the same line; useful when comparing a log against a report that normalized capitalization, misleading when comparing constants against strings.
Both options affect only what counts as identical. When a line matches under the relaxed rules, the panes still show each side's original text untouched — the option never rewrites what you see, only whether it is colored. That separation matters: a diff that quietly normalizes what it displays makes you unable to spot the difference that actually bit you, which is the one thing a comparison tool must never do.
Side by side or unified — and when each one wins
The default view puts the two texts in aligned panes with independent line numbers, so a changed line sits at the same height on both sides and your eye does not have to jump. Removed lines leave the right pane blank and added lines leave the left blank — the blank is information, telling you which side the line belongs to without reading a legend.
The unified view is the classic minus-plus stream. It exists because sometimes the deliverable is not "what changed" but the change itself: a unified diff pastes cleanly into a code review, a commit message, or a ticket. If you find yourself copying from the side-by-side view line by line, switch to unified first — the output is the same information in the exact shape that downstream tools expect. Both views render the same underlying diff, so switching never changes the result.
How to use it
- 1.Paste the original text on the left.
- 2.Paste the changed text on the right.
- 3.Compare — removed lines are red, added lines are green, with line numbers.
How Text Compare works under the hood
Text tools look trivial until encoding enters the picture. The bytes are unambiguous; the characters they represent are a guess unless the encoding is declared.
- 1
Read bytes, not characters
The file is read as an ArrayBuffer so the original bytes are preserved, including a byte-order mark if present.
- 2
Decode with a declared or detected encoding
TextDecoder converts bytes to text. UTF-8 is validated; a BOM is used when present; legacy encodings must be chosen explicitly because guessing between GBK and Shift_JIS is unreliable.
- 3
Transform as a pure function
Escaping, quoting, case changes and line-ending normalisation are applied to the decoded string, so the same input always gives the same output.
- 4
Encode and download
The result is encoded back to UTF-8 (or the format's own escaping rules) and returned as a Blob.
Processing pipeline
Why a file looks like mojibake
Mojibake is the same bytes decoded with the wrong table: Shift_JIS read as UTF-8, or GBK read as Latin-1. Nothing is corrupted in the file itself. If the output is garbled, the fix is to re-run with the correct source encoding, not to edit the text by hand — editing bakes the wrong characters in permanently.
CSV quoting is not optional
A CSV field containing a comma, a quote or a newline must be wrapped in double quotes, and inner quotes doubled. Tools that skip this produce files that look fine until someone imports them and the columns shift. This converter applies RFC 4180 quoting on output.
Where text tools stop
There is no reliable way to detect an unknown legacy encoding from content alone, and no way to recover bytes that were already lost. Mixed encodings inside one file cannot be fixed automatically. Very large inputs are capped because regular expressions and repeated string concatenation can take quadratic time.
Verify it yourself
Text is transformed in memory. Nothing is sent while it runs.
- 1.Open DevTools on this page and switch to the Network tab
- 2.Keep the filter on Fetch/XHR and run the tool
- 3.Confirm no request carries your file — you should see only page assets and fonts
Frequently asked questions
How is this different from Text Diff?
Text Diff outputs - / + diff markers as plain text — what you paste into a code review. Text Compare is the visual version: side-by-side panes, red and green highlighting, and line numbers, for when the question is simply "which lines changed?".
Does whitespace count as a change?
By default no. Indent and spacing differences are collapsed, so a re-indented line counts as unchanged. Turn the option off to compare strictly character by character.
What is the size limit?
3,000 lines per side. The cap exists because the diff runs in your browser and the algorithm's memory grows with the square of the line count — past the cap you get an honest error, not a frozen tab.
What this kind of conversion cannot keep
Text tools never leave the page: the string you paste is transformed in memory and written back to the result box. There is no request, no log and no retention, which also means there is no way to recover a value you closed the tab on.
More in Text
On this page
- What is Text Compare
- What this tool actually does with your file
- How it actually behaves
- How to use it
- How it works inside
- Frequently asked questions
Excel formula reference
29 functions with syntax, arguments and a table you can retype.
Browse the list →