Diff Checker: How to Compare Text Files and Code Online
Learn how text diffing works, what unified and side-by-side diffs mean, and how to spot changes between two versions of text or code quickly online.
What is a Diff?
A diff (from "difference") shows exactly what changed between two versions of a text file. Originally a Unix command-line tool, the concept is now central to version control (git diff), code review (GitHub pull requests), and document comparison. A diff shows:
- Lines that were added (typically shown in green)
- Lines that were removed (typically shown in red)
- Lines that were unchanged (context around the changes)
Types of Diff Formats
Side-by-side (split view): The two versions are shown in parallel columns. Changes are highlighted in corresponding lines. Best for reviewing moderate-length files where you want to see context easily.
Unified (inline) diff: The traditional format used by Git. Lines prefixed with + are additions, - are deletions. A header shows the chunk position: @@ -10,7 +10,8 @@ means starting at line 10 of the old file (7 lines) and line 10 of the new file (8 lines).
Common Uses for a Diff Checker
- Code review — comparing a modified function with its previous version before committing
- Configuration changes — spot changes between two versions of a server config file
- Contract/document changes — identify edits between draft versions
- API response comparison — check what changed between two API responses
- Database schema migration — compare schema before and after a migration
- Translation review — compare original and translated text
How the Myers Diff Algorithm Works
Most diff tools use the Myers algorithm (1986), which finds the shortest edit script — the minimum number of insertions and deletions needed to transform one text into another. It's the same algorithm that powers git diff.
Word-Level vs Line-Level Diff
Standard diffs compare line by line. For prose documents or single-line changes, a word-level diff is more useful — it highlights exactly which words changed within a modified line, rather than showing the whole line as changed.
Using the ToolsPal Diff Checker
- Paste your original text in the left panel
- Paste the modified text in the right panel
- Differences are highlighted instantly — additions in green, deletions in red
- A summary shows the total number of additions and deletions
Free Online Tool
Try Diff Checker
Compare two texts side-by-side and highlight differences.