Text Diff Tool

Compare two texts and find differences instantly. Line-by-line and word-by-word comparison with highlighted changes.

About This Tool

Text Diff compares two blocks of text and highlights the exact differences between them at the line and character level. It supports side-by-side and unified diff views, making it easy to spot additions, deletions, and modifications. Ideal for code reviewers, writers comparing document revisions, and anyone who needs to identify changes between two versions of text.

LineWord

How to Use

  1. Paste your original text in the left textarea.
  2. Paste the modified text in the right textarea.
  3. Click “Compare” to see differences highlighted by color.
  4. Toggle between Line and Word comparison modes for different detail levels.
  5. Use “Swap” to switch the original and modified texts.

FAQ

How does the text comparison work?

It uses the LCS (Longest Common Subsequence) algorithm to find common parts between two texts and identify added, removed, and modified lines. All processing happens in your browser.

Can I compare large texts?

Yes, you can. However, extremely large texts (tens of thousands of lines) may affect browser performance. It works well for typical documents and code comparisons.

What is the difference between line and word comparison?

Line comparison treats each line as a unit. Word comparison additionally highlights which specific words changed within modified lines.

Is my text stored anywhere?

No. All comparisons are processed locally in your browser. No data is sent to or stored on any server.

Related Tools

How It Works

This tool implements the Myers diff algorithm, the same algorithm used by Git. The algorithm finds the shortest edit script (SES) — the minimum number of insertions and deletions needed to transform one text into another. It operates on an edit graph where the x-axis represents the original text and the y-axis represents the modified text. Diagonal moves represent matching characters (no change), horizontal moves represent deletions, and vertical moves represent insertions.

The algorithm works by exploring edit paths of increasing distance (d = 0, 1, 2, ...) using a greedy approach that extends each path as far as possible along diagonals (matching sequences). This finds the longest common subsequence (LCS) as a byproduct. Once the shortest edit path is found, it is traced back to produce the diff output. For character-level highlighting within changed lines, a second pass runs the diff algorithm on the individual characters of each modified line pair, enabling precise intra-line change visualization.

Share

Related Articles

84+

Tools available

97+

Blog articles

English & 한국어

Languages

Bookmark this page! We add new free tools every week.