The diff algorithm is a fundamental tool in software development, underpinning git diff, code review tools, document version history, and configuration management. Properly diffing two pieces of text requires solving the Longest Common Subsequence (LCS) problem — finding the maximum set of lines common to both inputs so that the minimum number of additions and removals can be identified. A good diff viewer surfaces these changes with enough context to understand why a line changed, not just that it changed.
The comparison engine uses the Myers diff algorithm, the same algorithm at the core of Git and most Unix diff utilities. Myers's algorithm finds the shortest edit script (minimum number of line insertions and deletions) that transforms the original text into the modified text. Its time complexity is O(ND) where N is the total number of lines and D is the edit distance, making it fast for typical source code and configuration file sizes.
The output is rendered in three modes. Side-by-side (split) view renders original and modified text in two synchronized scrolling columns with line numbers and color-coded changes. Unified view renders the classic +/- interleaved format with 3 lines of context around each changed block. Inline view renders changes character-by-character within each modified line, showing exactly which words were inserted or deleted.
The whitespace normalization options preprocess each line before comparison: trimming trailing whitespace, normalizing runs of internal whitespace to a single space, and optionally lowercasing all characters. Blank line skipping removes lines that contain only whitespace before the comparison, reducing visual noise in config file diffs.
A developer compares two versions of a Nginx config file before deploying a routing change, using "ignore whitespace" to focus on meaningful rule differences.
A QA engineer diffs the API contract document against the implementation spec to identify fields that were added or removed without a changelog entry.
A tech lead reviews an AI-generated code refactor by pasting the before and after into the diff tool to verify only the intended logic changed.
A writer compares two drafts of technical documentation side by side to review copyediting changes before publishing.
Paste your original text in the left panel
Paste the modified text in the right panel
View the diff below — green for added, red for removed lines
Switch between side-by-side, unified, or inline views. Download as .diff file.
We packaged the .claude config that runs this site — 26 specialist agents, 14 workflow skills, and 6 rule files from 31 real production incidents. From $9.
Get the Claude Code Production Pack — $29