How to Compare Code Files Online — Complete Diff Guide 2025
Whether you're reviewing a pull request, debugging a regression, comparing config files, or checking what changed in a deploy — understanding code differences is a core developer skill. This guide covers all five diff view modes, when to use each, and how to interpret results like a senior engineer.
The 5 Diff View Modes — When to Use Each
- Unified view: All changes in a single column with +/- prefixes. Standard git diff format. Best for reading long diffs, creating patch files, posting in GitHub issues.
- Split view: Original left, modified right, aligned row-by-row. Best for complex changes where you need side-by-side visual comparison.
- Word-level diff: Highlights individual words that changed, not entire lines. Best when lines are mostly similar — a renamed variable, changed parameter, or updated value.
- Inline diff: Like unified but with added/removed content shown inline on the same row. Best for spotting small changes quickly without switching rows.
- 3-Way merge: Shows base + version A + version B simultaneously. Best for resolving merge conflicts when two branches diverged from a common ancestor.
Understanding Char-Level and Word-Level Highlighting
When this tool detects that a deleted line and an inserted line are similar (a modification rather than a complete replacement), it performs deeper analysis: character-level diff highlights the exact characters that changed within those lines. Word-level view goes further — it treats the entire text as a sequence of words and shows which words were added, removed, or kept.
Using 3-Way Merge for Git Conflict Resolution
Paste the common ancestor (base) in the middle panel, your branch changes in Version A, and the other branch in Version B. The diff engine detects where both branches changed the same region — these are your conflict zones, highlighted in yellow. This gives you the full context needed to manually resolve the conflict correctly.
Exporting and Using .patch Files
A .patch file is a standard unified diff that can be applied directly to a codebase using git apply changes.patch or patch -p1 < changes.patch. This makes the tool useful for sharing code changes without access to a shared repository — useful for open-source contributions, code reviews via email, or applying hotfixes to production servers.