PureDevTools

Diff Checker

Compare two texts and see exactly what changed — line by line and character by character

All processing happens in your browser. No data is sent to any server.

Paste text in both fields above to see the diff.

What Is a Diff Checker?

A diff checker (also called a text compare tool) finds and highlights the differences between two pieces of text. “Diff” comes from the Unix diff command, introduced in 1974, and the core algorithm used by most modern diff tools — including Git, GitHub, and this page — is the Myers diff algorithm, published by Eugene Myers in 1986. It finds the shortest edit script: the minimum number of line insertions and deletions needed to transform the original text into the modified version.

Developers use diff tools daily to review code changes, compare configuration files, detect unintended edits in documents, and understand what changed between two versions of any text.

How to Use This Diff Checker

  1. Paste your original text into the left (Original) text area.
  2. Paste your modified text into the right (Modified) text area.
  3. The diff appears automatically below — no button press needed.
  4. Choose Side by Side or Unified view using the toggle buttons.
  5. Use the options to refine the comparison:
    • Ignore whitespace — treat runs of spaces and tabs as equivalent
    • Ignore case — compare letters without distinguishing uppercase from lowercase
    • Trim lines — strip leading and trailing whitespace from each line before comparing
  6. Click ⇄ Swap to exchange original and modified.
  7. Click Clear all to start over.

Understanding the Diff Output

Side-by-Side View

The original text is shown on the left panel and the modified text on the right panel. Lines are displayed in matching rows:

For lines that have a corresponding change (one removed line paired with one added line), character-level highlighting shows the exact characters that were changed within the line. Changed characters appear with a darker background inside the line.

Both panels scroll together — scrolling one side automatically scrolls the other to keep lines in sync.

Unified View

The unified view combines both texts into a single column, similar to the output of git diff:

Two columns of line numbers show the original line number on the left and the modified line number on the right.

Diff Statistics

The statistics bar shows:

The Myers Diff Algorithm

The Myers algorithm solves the diff problem by modelling text comparison as a shortest-path problem on an edit graph. Every position (x, y) in the graph represents having compared x lines from the original and y lines from the modified text. Three types of moves are possible:

MoveMeaningEdit graph edge
Right (x→x+1)Delete a line from originalHorizontal
Down (y→y+1)Insert a line from modifiedVertical
Diagonal (x→x+1, y→y+1)Keep a matching lineDiagonal (free)

Finding the shortest diff is equivalent to finding the path from (0,0) to (N,M) with the fewest non-diagonal edges. The Myers algorithm achieves this in O(ND) time, where N is the total number of lines and D is the number of differences — making it very fast when files are mostly similar, which is the common case for code reviews and document edits.

Common Use Cases

Code review — Paste two versions of a function or file to see exactly what changed between them without leaving your browser.

Configuration comparison — Compare nginx.conf before and after an edit, or diff two JSON configuration files to spot differences.

Document editing — Compare a draft against a revised version to see which sentences were added, removed, or reworded.

Copy/paste verification — Quickly confirm that a block of text was copied exactly, or find subtle differences like extra spaces or changed punctuation.

Log analysis — Compare two log snippets to identify what entries appeared in one but not the other.

Comparison Options Explained

Ignore Whitespace

When enabled, sequences of whitespace characters (spaces, tabs) within each line are collapsed to a single space before comparison. This is useful when comparing code that was reformatted with different indentation styles (e.g., 2-space vs. 4-space indent), or documents that were processed by tools that normalize spacing.

Ignore Case

When enabled, all letters are converted to lowercase before comparison. Useful when comparing text where capitalisation may differ — for example, comparing SQL queries written in different case conventions, or text that was auto-corrected.

Trim Lines

When enabled, leading and trailing whitespace is stripped from each line before comparison. Useful for comparing files where some lines have trailing spaces that are invisible but would otherwise register as differences.

Frequently Asked Questions

How does this differ from git diff? This tool uses the same Myers algorithm as Git, so the output is comparable. The main difference is that git diff also handles file metadata, binary files, and multi-file patches, while this tool focuses on simple text comparison in the browser.

Can I compare code files? Yes. Paste the content of any text-based file — source code, JSON, YAML, HTML, CSS, Markdown, plain text — and the tool will compare them line by line. Binary files are not supported.

Why are some lines highlighted at the character level and others are not? Character-level highlighting is only applied to modified lines — a removed line that has a corresponding added line in the same change block. Lines that were purely deleted (with no corresponding addition) or purely added are highlighted at the whole-line level only.

What is the maximum text size? The tool processes text entirely in your browser and handles large files well. The Myers algorithm is optimised for the typical case where files are mostly similar. For texts that are completely different (e.g., two unrelated documents), the tool falls back to a simple delete/insert output to keep the browser responsive.

Is my text sent to a server? No. All comparison happens in your browser using JavaScript. No data is ever transmitted to any server. Your text stays completely private on your device.

Related Tools