Text Diff

Spot every change instantly. Paste two texts, see additions in green and deletions in red.

How the Text Diff Tool Works

Paste your original text in the first box and your modified text in the second. The tool compares both versions line by line using the Longest Common Subsequence (LCS) algorithm — the same method used by Git and professional diff tools.

Green lines (marked with +) are additions in the modified text. Red lines (marked with −) are deletions from the original. Switch between Inline and Side-by-side views depending on your preference.

Why Text Comparison Matters

Text diff tools are foundational to software development. Git uses diff algorithms at its core — every commit, pull request, and code review is built on the ability to compare two versions of a file and highlight exactly what changed. Without this capability, collaborative development would require manually reading entire files to spot changes, which is practically impossible on large codebases. The Myers diff algorithm, published in 1986 by Eugene Myers, is the most widely used — it finds the minimum number of edit operations (insertions and deletions) needed to transform one text into another, producing the most readable and intuitive diff output.

Beyond code, text comparison is essential across many professional fields. In legal work, lawyers use diff tools to track contract revisions — spotting a single changed clause in a 40-page document is critical, and a diff makes it instant. Academic integrity systems compare student submissions against source material. Translation teams use diff to check that revised source text is reflected in all language versions. Content editors compare drafts to ensure no unintended changes slipped through. Anywhere two versions of a document exist and accuracy matters, a text diff tool saves time and prevents costly errors.

How to Read a Diff Output

Green lines marked with a plus sign (+) represent content that was added in the modified text. Red lines marked with a minus sign (−) represent content that was removed from the original. Lines with no color or marker are unchanged and appear in both versions. In side-by-side view, the original appears on the left and the modified version on the right, with each changed line aligned to its counterpart — this layout is best for reviewing long documents where you want to read both versions in context. Inline view collapses both into a single column, which is better for small, focused changes where the context of surrounding lines is sufficient.

Here's a tip that's easy to overlook: when reviewing a contract revision or any legal document, look at the red (removed) lines first. What was taken away is often more significant than what was added — a removed liability clause, a deleted warranty provision, or an absent deadline can have major consequences. Similarly, when reviewing a code pull request, removed lines often reveal the intent of a change more clearly than the new lines alone. The diff is symmetric — swap the inputs to see the change from the other direction.

Word-level diffs, unified patch export, and a numbers-first stats card

Word-level granularity is now a toggle: when enabled, changed lines highlight the specific words that differ within the line, not just the entire line in red or green. That's useful when you're reviewing a lightly edited paragraph where most of the sentence stayed the same. Two whitespace options — ignore whitespace and ignore case — let you focus on meaningful changes without the diff getting noisy from indentation or capitalization differences. These are off by default. Turn them on when the content matters and the formatting doesn't.

Copy as unified diff exports the result in standard patch format — the format git diff and most code review tools consume. Paste it into a GitHub comment, a ticket, or a shell to apply with patch -p0. The stats card now shows characters changed in addition to lines added and removed, which is more informative when reviewing prose: a paragraph that gained 20 words but changed 3 lines tells a different story than one that changed 3 lines by moving punctuation.

Frequently Asked Questions

What algorithm is under the hood?
The tool uses the Longest Common Subsequence (LCS) algorithm, which finds the largest set of lines that appear in both texts in the same order. This produces minimal, human-readable diffs — the same approach used by Git.
Does my text ever leave my device?
No. All comparison happens entirely in your browser using JavaScript. Nothing is sent to any server — your text never leaves your device. You can even disconnect from the internet and it'll still work.
Can I compare code files?
Yes. The diff tool works on any plain text — code, prose, configuration files, CSV data. Paste any text you want to compare. The monospace font makes code diffs easy to read.
What does the Swap button do?
Swap exchanges the original and modified texts, effectively reversing the diff direction. Additions become deletions and vice versa. Useful when you want to see the changes from the opposite perspective.
What is the difference between character-level and line-level diff?
Line-level diff (what this tool uses) compares entire lines as units — a line either exists in both versions, was added, or was deleted. Character-level diff goes further and highlights which specific words or characters within a changed line were modified. Line-level is faster and easier to read for code and prose. Character-level is more useful for spotting typos, punctuation changes, or small wording edits within long paragraphs.
How do I compare two versions of a document I received by email?
Open both documents (Word, PDF, or any format), select all text, and paste each into the corresponding input box. For Word documents, use Ctrl+A to select all and Ctrl+C to copy. For PDFs, open them in a browser or PDF reader, select all text, and copy. The tool works with any plain text — formatting like bold, font size, and colors will not be preserved, but all the actual word content will be compared accurately.

You might also need

See all tools →

Complementary tools based on what you're doing