Text Diff
Compare two texts line by line and see added and removed lines.
What is Text Diff
This text diff tool compares two text blocks line by line and marks added (+), removed (-) and unchanged lines. It uses the longest-common-subsequence (LCS) algorithm, so the result is the minimal meaningful change. Handy for comparing JSON or XML before and after formatting. Up to 500 lines per block; everything runs locally.
🔒 Everything runs in your browser. Nothing is 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
Line-based comparison, with a hard limit
The comparison aligns two blocks line by line, marks additions and removals, and shows unchanged context. Blocks above 500 lines are rejected rather than silently truncated, because a diff that quietly drops the tail reports "no differences" for a change it never looked at.
Line granularity is the important limitation. A single character edited inside a long line marks the whole line as changed, so the reader has to find the difference by eye. Word-level or character-level diff is a different algorithm and produces a much noisier output for large documents.
Whitespace and line endings
A file saved with CRLF compared against the same content with LF differs on every line. Trailing whitespace, a missing final newline and tabs versus spaces each produce a diff where nothing meaningful changed — this is the reason version control offers ignore-whitespace options.
Normalising before comparing is usually right for prose and wrong for code, where indentation is structure. The honest approach is to look at both views: normalised to see whether there is a real change, exact to see what the tool will report.
What a diff does not tell you
It shows what changed, not whether the change is correct. Two documents can differ in one character and have completely different meanings, or differ in a thousand lines of reformatting and be equivalent.
For anything that will be merged or reviewed, pair the diff with the reason for the change. A diff is evidence, and evidence without a hypothesis is just noise — which is why the most useful review comment is rarely on the changed line itself.
How to use it
- 1.Paste the original text
- 2.Add a '---' line, then paste the new text
- 3.Run and review the diff
How Text Diff works under the hood
Developer tools here are deterministic byte and string transformations. The useful question is not whether they are fast, but whether the output can be verified against a reference.
- 1
Encode the input
Text is converted to UTF-8 bytes with TextEncoder; binary input is read as an ArrayBuffer.
- 2
Apply the primitive
Hashing and HMAC use Web Crypto (SHA-1/256/384/512); encoding, escaping and formatting are pure functions over the bytes or string.
- 3
Format the output
The result is rendered as lowercase hex, Base64, or the target syntax, with the exact same rules the specification defines.
- 4
Compare and copy
Output stays on the page so you can diff it against a reference implementation before using it.
Processing pipeline
Hashing is not encryption
A SHA-256 digest is one-way: there is no key and no way back. It proves that two inputs are identical (or not), which is what integrity checks need. It does not hide a password — for that you need a slow, salted KDF such as Argon2id, which this site uses for account passwords.
What runs where
Every transformation in this category runs in the tab. No key, token or payload is sent to us; the site cannot see what you hashed or decoded. That also means there is no server-side undo — if you close the tab, the input is gone.
Limits worth knowing
JWT decoding shows the header and payload; it does not validate the signature unless you supply the key, and it never proves the issuer is trustworthy. Regex-based tools can degrade badly on pathological input, so input size is capped. Very large payloads are also capped to keep the tab responsive.
Verify it yourself
Compare the output against a reference before you ship it.
- 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 do I separate the two texts?
By default with a line containing only ---. A blank-line separator is also selectable.
What is the size limit?
500 lines per block. Larger inputs are rejected to protect browser memory.
What this kind of conversion cannot keep
Developer tools here check what breaks silently: a missing canonical, a description over the length search engines display, a sitemap that returns 200 but lists dead URLs. Each result links to the exact line or URL, because a warning you cannot act on is noise.
More in Developer
On this page
- What is Text Diff
- 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 →