Diff Checker

Compare two texts and see the differences highlighted. Line, word, or character level. 100% client-side.

Original
Modified
Diff Output
Paste text in both fields to compare.

How to Use the Diff Checker

  1. Paste original text into the left (or top) input area.
  2. Paste modified text into the right (or bottom) input area.
  3. Choose a diff mode — Line Diff (default), Word Diff, Character Diff, or Ignore Whitespace.
  4. View the result — added lines appear in green, removed lines in red, unchanged lines in the default color.
  5. Copy the output — click Copy to get the unified diff as plain text.

What This Tool Does

This diff checker compares two blocks of text and produces a color-coded visualization of the differences. It uses a longest common subsequence (LCS) algorithm to determine the minimal set of changes needed to transform the original text into the modified text. The output clearly marks additions, deletions, and unchanged content so you can quickly identify what changed.

Features

  • Line-level diffing — compares text line by line, perfect for code and configuration files
  • Word-level diffing — highlights individual word changes within lines, ideal for documents and prose
  • Character-level diffing — finest granularity, highlights every character difference
  • Ignore whitespace — normalizes spacing before comparing, useful when only content matters
  • Line numbers — both original and modified line numbers displayed alongside the diff
  • Privacy — everything runs in your browser, no data sent anywhere

Diff Algorithms Explained

The core of any diff tool is the algorithm used to determine the longest common subsequence (LCS) between two sequences. The LCS represents the portions of text that are identical in both inputs. Once the LCS is computed, everything not in the LCS is either an addition (in the modified text but not the original) or a deletion (in the original but not the modified).

When to Use Each Diff Mode

Line Diff is best for comparing source code, log files, or any structured text where changes typically affect entire lines. Word Diff works well for natural language text, documentation, and content where individual word changes matter. Character Diff is useful for spotting typos, single-character changes, or comparing very similar strings. Ignore Whitespace is invaluable when comparing code that has been reformatted with different indentation styles.

Common Use Cases

Developers use diff checkers for code review (comparing old and new versions of code), configuration auditing (detecting changes in config files), content editing (tracking changes in articles or documentation), debugging (comparing expected vs. actual output), and merge conflict resolution (understanding conflicting changes). This tool gives you instant access to all these capabilities without installing any software. For code formatting before comparing, try our JSON Formatter, Markdown Preview, or Case Converter.

Understanding the Output

In the diff output, green lines represent additions (text that exists in the modified version but not the original). Red lines represent deletions (text that was in the original but removed in the modified version). Unmarked lines are unchanged and provide context for the changes around them.

Unified Diff Format

When you copy the diff output, it follows the unified diff format used by Git and most version control systems. Lines beginning with + were added, lines beginning with - were removed, and unmarked lines provide context. This format can be shared with teammates or saved for later reference.

Frequently Asked Questions

A diff checker is a tool that compares two pieces of text and highlights the differences between them. It shows which lines, words, or characters were added, removed, or changed. Diff checkers are essential for code review, document comparison, and version tracking.
No. This diff checker runs entirely in your browser using JavaScript. Your text never leaves your device. There is no server-side processing, no logging, and no data collection.
Line diff compares text line by line and highlights entire lines that differ. Word diff breaks each changed line into individual words and highlights only the specific words that changed. Character diff provides the finest granularity, highlighting individual character-level changes within words. Use line diff for code, word diff for prose, and character diff for spotting typos.
When Ignore Whitespace is enabled, the diff checker normalizes all whitespace (spaces, tabs, multiple spaces) before comparing. This means differences in indentation, trailing spaces, or spacing between words will not be flagged as changes. This is useful when comparing code that may have been reformatted.
Yes. Click the Copy button to copy the diff output in a unified diff text format. Lines prefixed with + are additions and lines prefixed with - are deletions. This format is compatible with most version control tools and code review systems.