The word "diff" comes from the Unix diff command, written in 1974. Fifty years later, it's still one of the most fundamental tools in a developer's kit. Every git commit, every pull request review, every deployment comparison — diff is there.
Most developers use git diff daily without thinking about it. But having a fast, visual diff tool outside of git is genuinely useful — for comparing config files, SQL migrations, API responses, content changes, or any two pieces of text.
How Diff Works
A diff algorithm answers one question: what is the shortest edit script that transforms text A into text B?
The most common algorithm is the Myers diff algorithm (1986), used by git. It finds the Longest Common Subsequence (LCS) of the two texts, then marks everything not in the LCS as either added or removed.
Given:
Original: Modified:
line 1 line 1
line 2 → line 2 (changed)
line 3 line 4
line 4
The diff output is:
line 1
− line 2
+ line 2 (changed)
− line 3
line 4
Lines with - were in the original but not the modified. Lines with + are new. Lines with no prefix are unchanged (context lines).
Reading a Diff
Inline view
All lines appear in a single column. Removed lines are shown before added lines for the same position. Best for short diffs.
Split view
Two columns side by side — original on the left, modified on the right. Unchanged lines align. Best for longer diffs where you want to read both versions in parallel.
The + and − counts
At the top of most diff tools you'll see something like +12 −5. That means 12 lines were added and 5 were removed. It doesn't tell you how much content changed — a single-character change on a line shows as 1 removal and 1 addition.
When to Use a Text Diff Tool
Config comparison. You're deploying to production and want to verify your production config matches staging, except for the environment variables you've intentionally changed.
Before/after content review. A writer updated a blog post. You want to see exactly what changed before approving the edit.
API response debugging. You called an API twice with slightly different params. Paste both JSON responses into a diff tool to see what the difference actually is (much faster than reading both blobs).
Database migration review. You have two SQL migration files that are very similar. Diff them to catch duplicate columns or missed constraints.
Catching accidental changes. You refactored something and want to confirm only the intended lines changed.
Tips for Better Diffs
Normalize whitespace first. If one version uses 2-space indentation and the other uses 4-space, the entire file will show as changed. Reformat both with your formatter before diffing.
Diff the right unit. Diffing a minified bundle is meaningless. Diff source files. Diff formatted JSON, not raw JSON blobs.
Use word-level diff for prose. Line-level diff is great for code. For prose, you want to see which words changed within a line — some tools support this.
Compare Anything Now
Our Diff Viewer runs the LCS algorithm directly in your browser. Paste two texts, get a color-coded line diff instantly — removed lines in red, added lines in green, unchanged lines in grey. Toggle between inline and split views. Nothing is sent to a server.