Diff Checker
Compare two texts and see the differences highlighted. Line, word, or character level. 100% client-side.
How to Use the Diff Checker
- Paste original text into the left (or top) input area.
- Paste modified text into the right (or bottom) input area.
- Choose a diff mode — Line Diff (default), Word Diff, Character Diff, or Ignore Whitespace.
- View the result — added lines appear in green, removed lines in red, unchanged lines in the default color.
- 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.