Skip to content

Text Diff

Text Diff Tool

Paste two pieces of text and see exactly what changed. Additions are highlighted in green, deletions in red, and unchanged lines fade into the background. Works on prose, code, JSON, YAML, log output, or any text where you need to track what moved between two versions.

Why Diffing Matters

Most editorial and engineering work is iterative: a draft, then a revision, then another. When the changes get past a sentence or two, eyeballing them stops working. A diff turns what changed? into a visual answer in under a second. The same principle drives version control systems like Git, but you don't need a repo or a commit history to compare two snippets — just paste and look.

This tool runs the diff entirely in your browser using a longest-common-subsequence algorithm. Nothing uploads, which matters if you're comparing draft contracts, internal documents, or anything covered by an NDA. For structural comparisons of formatted code, pair this with a JSON formatter or code beautifier first so whitespace doesn't dominate the diff.

How It Works

The diff operates line by line. Each line in the original is matched against the modified version using a longest-common-subsequence comparison, which finds the fewest added and removed lines. Lines present in both versions stay neutral; lines only in the original render as deletions; lines only in the modified version render as additions. The ignore whitespace toggle collapses leading/trailing space differences before comparison, useful when the only change is indentation. Ignore case treats Hello and hello as the same line.

Word-level highlighting inside changed lines is a stretch goal for a future revision. For now, line granularity catches the overwhelming majority of real review cases, and it scales to thousands of lines without slowing the browser.

Common Use Cases

Writers comparing draft and revised sections of a piece. Developers reviewing what a teammate changed before pulling it down. Lawyers running redlines on contract clauses (use the HTML entity encoder first if your clauses contain quotes that get mangled in transit). Sysadmins comparing config files between staging and production. Anyone reconciling two slightly-different exports from the same source system to find the field that drifted.

How We Compare

Standalone desktop tools like Beyond Compare, Kaleidoscope, and Araxis Merge are paid products that add directory-level and three-way merge features that matter for serious engineering work. Web-based diffs from Diffchecker, TextCompare, and similar services do what this tool does — but they upload your text to their servers. If your inputs are private, that's a hard non-starter. This tool gives you the same visual diff with the privacy guarantee that the data never crosses the network.

Frequently Asked Questions

What algorithm does this diff use?+
This tool uses a longest common subsequence (LCS) based algorithm for line-level comparison, then applies character-level diffing within changed lines to highlight exactly which characters were modified.
Can I compare code with this tool?+
Yes. The tool compares any plain text including source code, configuration files, JSON, HTML, and prose. Use the existing Diff Checker tool for syntax-highlighted code comparison.
Is there a size limit?+
The tool works well with texts up to about 10,000 lines. Very large texts may slow down since diffing runs entirely in your browser.
Does this tool upload my text?+
No. All comparison happens in your browser. Your text never leaves your device.
What diff algorithm does the tool use?+
A longest-common-subsequence (LCS) comparison of whole lines, which finds a minimal set of added and removed lines, the same result Myers' algorithm (used by git) gives in terms of how many lines change. Two 10,000-line texts with 100 scattered changes took about 6 seconds in Chrome on our test machine and reported exactly the 80 additions and 80 removals planted.
Can I diff JSON objects semantically?+
Yes. Tick "JSON mode" and both sides are parsed, object keys are sorted at every level and the result is pretty-printed before comparing, so {"a": 1, "b": 2} and {"b": 2, "a": 1} show no differences and a changed value shows as one changed line. Array order still counts, because [1, 2] and [2, 1] are different JSON. If either side is not valid JSON, the tool says where it failed and compares the raw text instead.
How is whitespace handled?+
Two options. By default every character counts. Ignore whitespace trims the start and end of each line and treats any run of spaces or tabs as one space, so indentation and spacing changes are not reported. Ignore case compares lines without regard to upper or lower case. In both cases the result still shows your original text.
Can I export the diff in unified format?+
Yes. Copy unified diff puts the changes on your clipboard and the .diff button downloads them, in the unified format used by git diff and GNU patch (--- / +++ headers, @@ hunks, 3 lines of context). We checked 60 random edits: every exported diff applied cleanly with both patch and git apply and reproduced the modified text exactly. There is no HTML or summary export; the on-page view is the side-by-side version.

📖 Learn More

Related Article How to Compare Text Files: A Guide to Diff Tools →

Built by Derek Giordano · Part of Ultimate Design Tools

Privacy Policy · Terms of Service