Text Diff Checker

Compare two texts or code snippets line by line. Added, removed and changed lines are highlighted, down to the exact words that differ.

Runs in your browserNo sign-upNothing uploaded

Paste text in both boxes to see the differences.

How to use the Text Diff Checker

  1. Paste the original text on the left and the changed text on the right, or open two files.
  2. The comparison updates as you type. Choose Side by side or Unified view.
  3. Tick Ignore whitespace, Ignore case or Ignore blank lines to hide noise such as re-indentation.
  4. Use Hide unchanged to focus on the changes with three lines of context around each.
  5. Click Copy as patch or Download .diff to get a standard unified diff you can apply with git apply or patch.

How this diff checker works

The tool splits both inputs into lines and runs the Myers difference algorithm, the same O(ND) algorithm used by git diff and GNU diff. It finds the shortest sequence of insertions and deletions that turns the original into the changed text, so the result shows the fewest possible changed lines. Identical leading and trailing lines are skipped first, which keeps comparisons of files with thousands of lines nearly instant.

When a removed line and an added line sit next to each other, they are paired as a modified line and diffed again word by word. The words that actually changed get a stronger highlight, so a renamed variable or an edited number stands out inside a long line.

Side-by-side vs. unified view

Side by side puts the original on the left and the new version on the right, with line numbers for both. It is the easiest view for reviewing prose, configuration files and short code changes. Unified view interleaves removed (-) and added (+) lines in one column, the format used by code review tools and patch files.

Unified diff (patch) format

The exported patch follows the diff -u format: a ---/+++ header, then hunks that start with @@ -l,s +l,s @@, where l is the first line number and s the number of lines of the hunk in each file. Each hunk includes three lines of unchanged context, so it can be applied with patch -p0 or git apply even if nearby lines have moved.

When to use the ignore options

  • Ignore whitespace treats lines as equal if they differ only in spaces or tabs. Use it after re-indenting code or switching tabs to spaces.
  • Ignore case is handy for SQL, HTML and log files where capitalisation does not matter.
  • Ignore blank lines hides lines that were only added or removed as spacing.

Frequently asked questions

Is my text uploaded anywhere?
No. The comparison runs entirely in your browser with JavaScript. Nothing you paste is sent to a server, so you can safely compare private code, contracts or configuration files.
How large can the texts be?
Files with tens of thousands of lines compare in well under a second on a typical laptop. Because the algorithm cost grows with the number of differences, two huge, completely different files take longest.
Can I compare two files instead of pasting?
Yes. Use the Open file buttons above each box to load a local file. The file is read by your browser and never uploaded.
Why is a line shown as removed and added instead of modified?
Lines are paired as “modified” only when a block of removed lines sits directly next to a block of added lines. If the two lines share very little text, the word-level highlight is skipped because it would be noisier than showing the whole line as changed.
How do I compare JSON objects?
Use the JSON Diff tool. It compares the parsed structure, so key order and formatting do not create false differences, and it lists the exact paths that changed.

Related tools