Line, word, or character granularity?
Pick based on how similar your two texts are and what you care about:
- Line diff — best for code, config files, logs. A single modified character marks the whole line as changed.
- Word diff — best for prose, articles, emails. Shows exactly which words changed even within an otherwise-identical sentence.
- Character diff — best for short strings, regex, identifiers. Shows individual character edits. Slow for long text (O(n×m) cost).
What's the algorithm?
This tool uses a Longest Common Subsequence (LCS)-based diff. It builds a dynamic-programming
table of LCS lengths between the two inputs, then walks back to emit a sequence of keep/add/remove operations.
This is essentially the classic Hunt–McIlroy
diff that diff -u uses. Runs in O(n×m) time and memory, which is why the tool caps input size
at ~2M cells.
For very large inputs (whole-file diffs of 100KB+), professional tools use Myers' variation which runs in O(ND) time (D = edit distance). For typical tool-site use (a few KB max), the straight LCS approach is clearer and fast enough.
Ignore-whitespace and ignore-case
- Ignore whitespace — tokens are compared with all whitespace stripped. Useful for comparing text where formatting differs but content is the same.
- Ignore case — case-insensitive comparison. Useful for comparing SQL, CSS class names, or anything where case is cosmetic.
Both options affect comparison only. The displayed tokens keep original casing/whitespace.
Use cases
- Code review prep — paste old vs new code to see exactly what changed before opening a PR.
- Document version comparison — catch every word edit between two drafts.
- License/contract diff — spot material changes between versions.
- Test output comparison — paste expected vs actual to find the mismatch.
- Configuration audit — diff two config files to find drift.
For structured JSON, use the JSON Diff
If you're comparing JSON, use our JSON Diff instead. It does structural diff — doesn't care about key order or formatting — while this text diff treats the raw characters. Same for comparing config files in YAML: convert both to JSON first, then JSON-diff.
Frequently asked questions
Why does character diff show the whole word changed?
It doesn't — character diff works at the individual-character level. If you see whole words marked, you're probably in Word or Line mode. Switch to Character mode.
Why is it slow on big inputs?
LCS diff is O(n×m). Character-level diff on two 1000-char strings is 1M cells — fine. 10,000 chars each is 100M cells — gets slow and uses a lot of memory. Switch to Word or Line granularity for big inputs.
Is my text uploaded anywhere?
No. Runs entirely in your browser.
Does this handle Unicode correctly?
Yes for BMP characters (including Latin, CJK, most accented). Emoji that use surrogate pairs may be split at character-granularity mode — use word or line mode for emoji-heavy content.
Related tools
- JSON Formatter — Format, validate, and beautify JSON online. 100% client-side — your data never leaves your browser.
- XML Formatter — Format, validate, and beautify XML documents.
- YAML ↔ JSON Converter — Convert between YAML and JSON formats with full fidelity.
- JSON Diff — Compare two JSON objects structurally with field-by-field diff.
Pillar
Part of Data & Format.
Written by Mian Ali Khalid. Last updated 2026-04-25.