Compare two texts online with difference highlighting. Finds added, removed, and changed lines
Line-by-line comparison of two texts.
Added lines are highlighted in green, removed lines in red. Unchanged lines are displayed in gray.
Useful for comparing configuration files, code snippets, and text documents.
Text Diff — Online Text Comparison with Change Highlighting
The tool compares two texts and shows all differences: added lines (green), removed (red), and changed (with character-level highlighting). Supports side-by-side mode and line numbering.
How the Comparison Algorithm Works
The tool uses the LCS (Longest Common Subsequence) algorithm — the same used by Unix diff and Git. It minimizes the number of edits (insertions and deletions) to transform the original into the modified version.
For adjacent removed/added lines, an additional character-level inline diff finds the common prefix and suffix to show exactly which characters changed.
Display Modes
| Mode | Description | When to use |
|---|---|---|
| Unified | Changes in one stream, full context visible | Small edits, patch review |
| Side-by-side | Original left, modified right | Large blocks, logic comparison |
| Inline diff | Character-level changes highlighted | Typos, pinpoint edits |
Use Cases
- Code review — compare old and new code versions before a pull request
- Documents — find changes between contract or spec versions
- Configs — compare nginx.conf or docker-compose.yml before/after editing
- Translations — verify all strings are translated by comparing original with translation
Frequently Asked Questions
How many lines can be compared?
No strict limit. Processing happens in the browser, practically instant up to 10,000 lines.
Is data sent to a server?
No. Comparison runs entirely in the browser. Confidential code stays on your device.
How to compare JSON files correctly?
Format both JSONs in the JSON formatter with identical indentation, then paste into Text Diff.
For pattern matching use the Regex tester.
Useful articles
WCAG Color Contrast: Website Accessibility Guide
A complete guide to color contrast: WCAG 2.1 standards, AA and AAA levels, calculation formula, practical examples of good and bad contrast, and how to fix accessibility issues.
CSS Border Radius: Rounding Element Corners
How to use border-radius: syntax, shorthand notation, elliptical corners. Online border-radius generator.