Text Diff

Compare two pieces of text and see the differences highlighted.
ORIGINAL
MODIFIED

Line-by-line

LCS algorithm highlights added, removed, unchanged lines.

Color Coded

Green for added, red for removed, gray for unchanged.

Real-time

Diff updates as you type.

Client-side

All processing in your browser. No data uploaded.

About Text Diff

Comparing two versions of text is a fundamental task in writing, coding, and document management. The Text Diff tool shows you exactly what changed between two pieces of text, using the same Longest Common Subsequence (LCS) algorithm that powers version-control systems like Git. Lines added in the modified version are highlighted in green with a "+" prefix, lines removed from the original appear in red with a "−" prefix, and unchanged lines remain neutral. A summary bar at the top shows the total count of added, removed, and unchanged lines at a glance. Common use cases include reviewing document revisions before publishing, comparing configuration files when debugging a deployment issue, checking what changed in a pasted code snippet, proofreading two drafts of an article, and verifying that a find-and-replace operation produced the expected results. The diff is recalculated in real time as you type in either panel, so you can make live edits and immediately see the impact.

How to Use Text Diff

  1. Paste your original text into the left "ORIGINAL" panel.
  2. Paste the modified or newer version of the text into the right "MODIFIED" panel.
  3. The diff result appears automatically below both panels.
  4. Lines highlighted in green (with +) are new additions; lines in red (with −) were removed.
  5. Read the summary line to see the total number of added, removed, and unchanged lines.
  6. Edit either panel at any time to update the diff in real time.

Frequently Asked Questions

What algorithm is used for the diff?

The tool uses the Longest Common Subsequence (LCS) algorithm, which is also the foundation of the Unix diff command and Git. It finds the largest set of lines common to both texts and marks everything else as added or removed.

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

The comparison is line-by-line. Each newline creates a separate unit for comparison. For word-level or character-level diffs, you can break text into one word or character per line before pasting.

Can I use this to compare code files?

Yes. The tool works well for any plain text including source code, configuration files, JSON, SQL, and markdown. Just paste the contents of each file into the respective panels.

Is there a size limit on the text I can compare?

There is no hard limit, but very large texts (thousands of lines) may cause the browser tab to slow down since the LCS algorithm has O(m×n) time complexity. For best performance, compare sections under a few hundred lines at a time.

Can I copy the diff output?

The diff result is displayed as formatted HTML for readability. To copy the raw text of a single panel, select and copy it directly from the textarea. We plan to add a copy-diff button in a future update.

Related Tools

Text Line UtilitiesWord CounterMarkdown ViewerJSON Formatter
Free Ebook
Top 10 Free Tools Every Developer Needs

Top 10 Free Tools Every Developer Needs

Boost your productivity instantly. Get our exclusive cheatsheet featuring the most essential web utilities you didn't know you needed, delivered straight to your inbox.

We respect your inbox. Unsubscribe at any time.