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
How to use the Text Diff Checker
- Paste the original text on the left and the changed text on the right, or open two files.
- The comparison updates as you type. Choose Side by side or Unified view.
- Tick Ignore whitespace, Ignore case or Ignore blank lines to hide noise such as re-indentation.
- Use Hide unchanged to focus on the changes with three lines of context around each.
- Click Copy as patch or Download .diff to get a standard unified diff you can apply with
git applyorpatch.
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.