Text Diff Checker
Compare two text snippets side-by-side and highlight the differences. Word- and line-level diff, everything runs in your browser.
Last updated:
| 1 | − | function greet(name) { | |
| 2 | − | console.log("Hello, " + name); | |
| 3 | − | return name; | |
| 1 | + | function greet(name, greeting = "Hello") { | |
| 2 | + | console.log(greeting + ", " + name + "!"); | |
| 3 | + | return { name, greeting }; | |
| 4 | 4 | } |
Paste two blocks of text above to compare them side-by-side. Added, removed, and unchanged lines are highlighted, just like git diff. Everything runs in your browser.
What is Text Diff?
A text diff checker compares two versions of text and highlights exactly what changed — added lines in one color, removed lines in another. It's the same mechanism behind git diff and code-review tools. Beyond code, it's invaluable for comparing config files, contract revisions, log snapshots, and any two documents where you need to see precise differences fast.
How to compare two texts
- 1Paste the original text on one side and the revised text on the other.
- 2The tool aligns the two and highlights added, removed, and unchanged lines.
- 3Scroll through to review each change in context.
- 4Copy or note the differences for your review or changelog.
Use Cases
Compare config versions
Spot exactly what changed between two versions of an .env or config file.
Review text revisions
See edits between two drafts of documentation, a contract, or an email.
Diff log snapshots
Compare two log captures to find which lines appeared or disappeared between runs.
Code Examples
Diff view
unchanged line
- old value
+ new value
unchanged lineKey Concepts
- Line-level vs word-level diff
- Line-level marks whole lines as changed; word-level highlights the specific words within a line that differ. Line-level matches git's default.
- Longest Common Subsequence (LCS)
- Most diff algorithms find the longest sequence of unchanged lines, then mark everything else as added or removed.
- Whitespace sensitivity
- By default, trailing spaces and line-ending differences (CRLF vs LF) can show as changes. Normalize input if that's noise.
Tips & Best Practices
- ▸Invisible differences (trailing spaces, CRLF vs LF line endings) often explain 'identical-looking' lines flagged as changed.
- ▸For code review, line-level diff matches what git and GitHub show.
- ▸Large inputs (multi-MB) can slow browser rendering; diff smaller sections when possible.
- ▸Sort or normalize both inputs first if order isn't meaningful, to reduce diff noise.
Frequently Asked Questions
Which diff granularity is used?
Line-level by default, showing added, removed, and unchanged lines. This matches how git diff and most code review tools present differences.
Are large files supported?
The tool runs entirely in the browser. Inputs up to a few megabytes work smoothly; much larger inputs may slow down rendering.
Related Tools
Regex Tester
Test regular expressions online. Live match highlighting, capture groups, and support for JavaScript flags (g, i, m, s, u, y).
XML Formatter
Format, beautify, and validate XML documents online. Handles namespaces, CDATA sections, and mixed content.
SQL Formatter
Format and beautify SQL queries. Supports SELECT, JOIN, subqueries, CTEs, and multiple SQL dialects.
Case Converter
Convert text between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, and more.
Word Counter
Count words, characters, sentences, paragraphs, and reading time in any text. Includes a byte-size estimate for storage planning.
Markdown → HTML
Convert Markdown to HTML with a live preview. Supports GitHub Flavored Markdown (tables, task lists, strikethrough) and code fences.