Home/ Glossary/ Text Diff
Analyse

Text Diff

The text diff tool compares two blocks of text and highlights the differences between them at the line, word, or character level. It displays results in a side-by-side or unified view with color-coded additions and deletions. It is useful for reviewing document changes, comparing configuration files, and spotting differences between two versions of any plain text content.

What is the Text Diff Tool?

The text diff tool implements the Myers diff algorithm to compute the shortest edit script between two text inputs. It identifies which lines were added (shown in green), which were removed (shown in red), and which are unchanged. Within modified lines, word-level or character-level highlighting shows the exact characters that differ. This is the same type of diff used by version control systems like Git, but accessible through a browser interface without any setup.

How does it work?

Paste two texts into the left (original) and right (modified) panels. Select the diff granularity — line, word, or character. The tool computes the longest common subsequence between the two inputs and generates a structured diff. Results are rendered in either a unified view (one panel with +/- markers) or a side-by-side split view. Unchanged blocks can be collapsed to focus on the differences. The tool works entirely in the browser with no server-side processing.

Typical Use Cases

  • Comparing two versions of a configuration file after an update
  • Reviewing changes in a copied document or article before publication
  • Spotting differences between a template and a generated output
  • Comparing log files to identify new error lines after a deployment

Step-by-step Guide

  1. Step 1: Paste the original text into the left panel.
  2. Step 2: Paste the modified text into the right panel.
  3. Step 3: Select the diff granularity (line, word, or character).
  4. Step 4: Review the highlighted additions and deletions.

Example

Input
Left: 'Hello World' | Right: 'Hello Claude'
Output
Removed: 'World' | Added: 'Claude'

Tips & Notes

  • Use character-level diff for catching typos in short strings like configuration values or URLs.
  • Collapse unchanged sections to reduce visual noise when comparing long documents.
  • Normalize line endings (CRLF vs LF) before diffing to avoid false differences on Windows-originated text.

Frequently Asked Questions

What algorithm does the diff tool use?
The tool uses the Myers diff algorithm, the same algorithm used by GNU diff and Git. It computes the minimum number of insertions and deletions needed to transform one text into the other.
Can I diff binary files?
No. The text diff tool works with plain text only. Binary files should be compared with specialized binary diff tools. However, you can diff the hexadecimal representation of binary data if needed.
Text Diff
Compare two texts and instantly see what was added, removed, or changed — with line-by-line and word-by-word highlighting.
Open Tool