Text Diff Tool Online Free
Paste two versions of any text and see every difference highlighted instantly. Line level and character level diff, side by side or unified view. Runs entirely in your browser.
How this text diff tool finds the smallest set of changes between two texts
Comparing two blocks of text for what changed is a matching problem: find the largest set of lines that both texts share, in the same order, and treat everything else as added or removed. This tool solves it with the Myers difference algorithm, the method Eugene Myers published in 1986 and the one Git and GNU diff use by default. It runs on lines first, and then, in word or character mode, again inside each changed line.
The comparison runs entirely in your browser. Neither text is uploaded or logged.
The Myers algorithm, step by step
Myers finds a shortest edit script, the fewest line insertions and deletions that turn text A into text B. Its running time grows with the size of the texts times the number of differences, not with the size of A times the size of B, so two long files that differ in a few places compare almost instantly.
A worked diff
Text A: "The quick fox" / "jumps over the dog" Text B: "The quick fox" / "leaps over the dog"
The first line matches exactly and is marked equal. The second line differs by one word, so at the line level it is a full removal plus a full addition. Switch to word level and the tool compares the words inside that pair of lines, so only jumps and leaps are highlighted rather than the entire line.
| Setting | Effect |
|---|---|
| Ignore case | Both texts are lowercased before comparison, though the original casing still displays in the output |
| Ignore whitespace | Runs of spaces and tabs collapse to one space and the line is trimmed before comparison |
| Unified view | One column, additions and removals shown inline in original document order |
| Side by side view | Two columns, with blank filler rows keeping both panes aligned |
What gets counted and shown
Stats row
Added, removed and unchanged line counts are shown above the result. The tool also tells you when the texts are identical, when they only differ in ignored case or spacing, and when their line endings differ.
Copy or download as a patch
Copy diff and Download .diff produce a standard unified diff, with @@ hunk headers and three lines of context, the same format as diff -u and Git. It pastes cleanly into a code review comment or ticket and can be applied with patch.
- Longest common subsequence problem for the matching problem every line diff solves.
- Diff for the history of the Unix utility and its output conventions.
- Eugene Myers, An O(ND) Difference Algorithm and Its Variations, 1986 for the algorithm this tool and most production diff tools use.
- Wagner-Fischer algorithm for the closely related edit distance DP formulation.
Comparisons this makes easy
Comparing two drafts of a contract to spot exactly which clauses changed, reviewing an edited blog post against the original before publishing, checking two versions of a config file line by line, catching what an editor changed in a manuscript, and verifying that a translated document still matches the structure of its source. Word level is the one to reach for when a single word swap inside a long paragraph is what you need to see, and char level for typos and code.
FAQ: Text Diff Tool Online Free
Yes, completely free. No account, no signup, and no payment ever required.
No. The diff algorithm runs entirely in your browser using JavaScript. Your text never leaves your device. Safe to use with confidential documents, contracts, or code.
Line level diff treats each line as one unit and marks entire lines as added or removed. Word level and character level go further and highlight the exact words or characters that changed within each modified line. Use them when you need to spot small edits inside long lines.
When ignore case is on, the tool treats uppercase and lowercase letters as equal. A line that changed only in capitalization will show as unchanged. Useful when comparing text that may have been reformatted.
It collapses multiple spaces and tabs into a single space before comparing. Two lines that differ only in spacing will count as identical. Useful when comparing code that was auto-formatted or pasted from different editors.
Yes. Paste any plain text including code, JSON, YAML, SQL, HTML, or prose. The tool works on any text content.
The tool uses the Myers difference algorithm, the same one Git and GNU diff use by default. It finds the smallest number of line additions and removals that turn one text into the other, and it stays fast on large files.
From the blog
Writing about writing tools
Readability scoring, keyword density and the rest, examined properly.