Text Diff

Line-by-line diff of two text blocks — green adds, red deletes, gray context.

Tool Media & Files Updated Apr 19, 2026
How to Use
  1. Paste your "Before" text in the top textarea.
  2. Paste your "After" text in the bottom textarea.
  3. The line-by-line diff updates automatically — additions in green, deletions in red, unchanged context in gray.
  4. Toggle "Trim trailing whitespace" to ignore trailing spaces and tabs.
  5. Toggle "Case-insensitive" if you want capitalization differences ignored.
  6. Statistics at the top of the diff show added, removed, and unchanged line counts.
Compare
Diff
Paste content on both sides.

Legend

+ line
Green = added
− line
Red = removed
Context
Gray = unchanged
Algorithm
LCS
Longest common subsequence.
Scale
~5000 lines
Beyond that, split first.
Privacy
Local

About the Text Diff

Need a hand with image, audio and file tasks? The Text Diff does the work for you — free, and right here in your browser. Line-by-line diff of two text blocks — green adds, red deletes, gray context.

How it works

Type in what you have, and the answer shows up right away. Change anything and it updates by itself. Everything runs in your browser, so it is fast and nothing you type is sent away.

Want the deeper story? The Knowledge Base explains the ideas behind the tools in more detail.

Frequently Asked Questions

Is this word-level or line-level diff?

Line-level — each line is treated as an atomic unit and either matches a line in the other text or doesn't. For changes within a long line (a single word swapped, a number changed), the whole line shows as one removal plus one addition. For finer-grained word or character diff, paste each line into a different tool that highlights inline changes.

How does ignoring whitespace work?

The 'Trim trailing whitespace' option strips spaces and tabs at the end of each line before comparing. Useful for files that may have inconsistent line endings (Windows CRLF vs. Unix LF) or trailing spaces from copy-paste. Whitespace within a line is still significant — ' hello' and 'hello' would still show as different lines.

What's the LCS algorithm?

Longest Common Subsequence — the same algorithm used by Unix diff, git diff, and most other diff tools. It finds the longest sequence of matching lines between the two inputs (in order, but not necessarily contiguous) and treats everything else as additions or deletions. Time complexity is O(n × m); for large inputs (>5,000 lines per side) it can become slow.

Will the diff handle reordered text correctly?

Pure reorders show as a delete plus an add at the new position — there's no concept of 'moved' lines in standard diff (git diff has a --color-moved flag for this; line diff alone doesn't). For comparing reordered lists (sorted output, configuration files), sort both sides first then diff.

Will it work for code?

Yes — it's the same algorithm IDEs use for their compare-files feature. For real code review, GitHub/GitLab/your IDE will give a better experience because they include syntax highlighting and inline word-level diff. This tool is for ad-hoc comparison: one-off snippets, log file changes, configuration drift.

Is my text uploaded anywhere?

No. Everything runs entirely in your browser. The diff is computed locally — text is never transmitted to a server. You can safely compare drafts of confidential documents, sensitive configs, or proprietary code.

How do I use the Text Diff?

Just type your numbers. The answer shows up right away — there is no button to press. Change anything and it updates by itself.

Is it free? Does it work without internet?

Yes to both. It is free with no sign-up, and once the page has loaded it keeps working even with no internet.

Where does my data go?

Nowhere — every calculation runs on your own device. Nothing you enter is uploaded, logged, or stored.

Common Use Cases

Comparing config drift

Find out what changed between two versions of a config file (.env, nginx.conf, application.yml).

Document revision tracking

See exactly what your editor or co-author changed in a draft.

Log file analysis

Diff log output from before vs. after a deployment to spot new error messages or warnings.

Code review without git

Quick line-by-line comparison of two snippets when you don't have the full repo handy.

Translation work

Compare two translations of the same source text to see structural differences.

API response comparison

Diff JSON responses from two API versions or environments to find breaking changes.

Last updated: