Word, Line, and Character Diff Modes Explained
When you compare two texts, the way you split them into units affects what changes you see. DiffLab's Text Compare tool offers three modes: line, word, and character. Each mode answers a different question about what changed.
Line mode: structural changes
Best for: config files, logs, source code, legal documents
Line mode treats each line as an atomic unit. If anything on a line changes, the entire old line is marked as removed and the new line is marked as added. This makes it easy to see which lines were touched, but it does not show which specific words within the line changed.
Example: If port: 8080 becomes port: 8443, line mode marks the whole line as modified. You know the line changed, but you have to read both versions to spot the number difference.
Word mode: semantic changes
Best for: prose, articles, contracts, commit messages
Word mode first aligns lines, then within each modified line pair it runs a word-level diff. Individual changed words are highlighted inline — red for removed words, green for added words. This is the most useful mode for human-readable text because it shows exactly which words changed.
Example: If The quick brown fox becomes The slow brown fox, word mode highlights only quick as removed and slow as added. The surrounding words stay unhighlighted.
Character mode: precise edits
Best for: typos, single-character fixes, identifiers, data values
Character mode goes one step further: it splits each line into individual characters and diffs at that level. This is useful when the change is a single character — a typo fix, a changed digit, or a casing difference — and you want to pinpoint it exactly.
Example: If userID becomes userId, character mode highlights only the D as removed and d as added. Line and word modes would highlight the whole word or line.
Which mode should you use?
- Start with line mode. It gives you the broad picture: which lines changed.
- Switch to word mode when you need to see the specific words that changed within those lines. This is the default mental model for most people reviewing prose.
- Use character mode when the change is subtle — a typo, a casing change, or a single-digit number change — and word mode does not narrow it down enough.
Additional options
DiffLab also offers two toggle options that work with all modes:
- Case sensitive: When on (default),
Helloandhelloare treated as different. Turn it off to ignore case differences. - Ignore whitespace: When on, trailing whitespace and extra blank lines are normalized before comparison. This helps when comparing files from different editors that add or trim spaces.
Try all three modes on your text.
Open Text Compare