What is Text Diff Checker?

Free text diff checker. Paste two blocks of text to instantly see what was added, removed, or changed line by line. Great for comparing documents, code, or any text. No signup required.

No file uploadsNo tracking of inputsNo account requiredWorks offline after first load

Text Diff runs entirely in your browser using JavaScript (browser). Your data never leaves your device.

Free Text Diff Checker

Compare any two blocks of text side by side and see exactly what changed. Added lines are highlighted in green, removed lines in red, and unchanged lines in white. Great for comparing document versions, code snippets, config files, translated text, and more. 100% browser-based — your text never leaves your device.

Free to embed on your website · No signup required

🔍

Line-by-line diff

Uses the LCS algorithm — the same approach as Git diff — for accurate change detection.

🎨

Color-coded output

Green lines were added, red lines were removed, plain lines are unchanged.

🔒

100% private

All comparison happens in your browser. Your text is never sent to a server.

Frequently Asked Questions

How does the diff work?+

The diff uses the Longest Common Subsequence (LCS) algorithm to find the minimum set of changes needed to transform the first text into the second. This is the same algorithm used by Unix diff and version control systems like Git.

Can I compare code files?+

Yes. Paste any code — JavaScript, Python, JSON, YAML, HTML — and the diff will highlight exactly which lines changed. This is useful for reviewing changes before committing or comparing configuration files.

Does it compare word by word or line by line?+

The primary diff is line-by-line. Within changed lines, individual word differences are highlighted to make it easier to spot small changes inside a line.

Is there a size limit?+

No artificial limit. The LCS algorithm is O(n²) in the worst case, so very long texts (10,000+ lines) may take a second to process. Most practical comparisons are instant.

Is my text stored anywhere?+

No. All comparison happens in your browser with JavaScript. Your text is never sent to any server.

Can I use this to compare JSON or configuration files?+

Yes, and it works especially well for structured text like JSON, YAML, TOML, and .env files. Paste the old version on the left and the new version on the right. The diff highlights exactly which lines were added, removed, or unchanged. For JSON specifically, consider formatting both versions with the JSON Formatter first — comparing minified JSON produces noisy diffs.

What is the "ignore whitespace" option for?+

When enabled, trailing whitespace and blank lines are normalized before comparison. This prevents trivial differences — like an IDE that removes trailing spaces — from appearing as changes in the diff. Use it when comparing documents that went through different editors or text processors that may have altered spacing.

How Text Diff Works

This tool uses the Longest Common Subsequence (LCS) algorithm — the same algorithm used by Unix diff, Git, and most version control systems. LCS finds the largest set of lines that appear in the same order in both texts, then marks everything else as added or removed. This produces the minimum edit distance: the smallest number of insertions and deletions needed to transform text A into text B. The algorithm runs entirely in your browser, so your text is never sent to any server.

Use Cases for Text Diff

Text diff is useful far beyond comparing code. Common real-world uses include: comparing two versions of a legal contract or agreement to see what changed between drafts, checking what an AI model altered in a document it rewrote, reviewing edits made to an article or essay before accepting them, comparing configuration files between staging and production environments, verifying that a copy-paste operation preserved all content, and auditing generated output between two runs of a script to catch regressions.

Comparing JSON, YAML, and Configuration Files

The text diff works especially well for structured text formats like JSON, YAML, TOML, and .env files. For best results with JSON, format both versions with a JSON formatter first — comparing minified JSON (where everything is on one line) produces a single-line diff that tells you nothing useful. Once both versions are pretty-printed with consistent indentation, the diff will highlight exactly which keys and values changed.

Understanding Diff Statistics

The statistics bar shows the number of lines added (in green), removed (in red), and unchanged. A high ratio of additions to removals suggests the new version is significantly longer than the original. A symmetric number of additions and removals with few unchanged lines suggests a large rewrite. Lines that were modified — changed in place rather than moved — appear as one removed line and one added line in the diff, since the algorithm operates at the line level. This is why a single word change in a paragraph shows the entire paragraph as removed and re-added.