What is a Text Diff?
A diff (short for difference) is a comparison between two versions of text that highlights exactly what changed — which lines or characters were added, removed, or modified. Diff tools originated in software development for tracking code changes, but they’re useful any time you need to compare two versions of any text.
Without a diff tool, comparing two similar texts by eye is slow, error-prone, and exhausting. A diff immediately shows you what’s different — nothing to overlook.
What Does This Tool Do?
This tool compares two blocks of text and highlights the differences. Added content is shown in green, removed content in red. You can see the changes at a line-by-line or character level, making even small differences immediately visible.
How to Use This Tool
- Paste the original text into the left panel.
- Paste the modified text into the right panel.
- Differences are highlighted automatically.
- Added lines are shown in green, removed lines in red.
Common Use Cases
- Document revision: Compare two drafts of a document to see exactly what changed.
- Config file comparison: See the differences between two versions of a configuration file.
- Code review: Spot changes in a code snippet without the context of a full git diff.
- Data validation: Compare two exported data sets to find discrepancies.
- Contract or legal text: Quickly identify changes between two versions of an agreement.
How to Read a Diff
Diff output follows conventions that are worth knowing because they appear everywhere — this tool, git, code review platforms:
- Green / added — content present in the new version but not the original.
- Red / removed — content present in the original but gone from the new version.
- A changed line appears as a remove + add pair; the character-level highlight inside shows exactly which part changed.
- Unchanged context is shown dimmed so you can locate the changes within the document.
A subtle point: diffs show an interpretation of the change, not the change itself. If you move a paragraph, the diff shows it as deleted in one place and added in another — the algorithm can’t know it “moved.”
Tips for Cleaner Comparisons
- Normalize before comparing. Differences in line endings (Windows
\r\nvs Unix\n), trailing spaces, or tabs vs spaces create noise that hides real changes. If the diff looks like everything changed, whitespace is usually why. - Compare like with like. Formatting a JSON or SQL file with our JSON Formatter or SQL Formatter before diffing turns a one-line-vs-pretty-printed comparison into a meaningful line-by-line one.
- Sort when order doesn’t matter. Comparing two lists (dependencies, email addresses, IDs)? Sort both first so the diff shows genuine additions and removals instead of reordering noise.
- Break long paragraphs. Line-based diffing works best with reasonably short lines. Prose with one paragraph per line will flag the entire paragraph for a single word change — the character-level highlight then pinpoints it.
Frequently Asked Questions
Does it compare word-by-word or line-by-line?
The tool compares line by line and also highlights character-level differences within changed lines, so you can see exactly which words or characters were altered.
Can it handle large texts?
Yes, though performance on very large documents depends on your device. Most real-world use cases — documents, configs, code files — work instantly.
Is my data private?
Yes. Both texts are compared entirely within your browser. Nothing is sent to any server.
Why does the diff mark lines as changed when they look identical?
Invisible characters — trailing spaces, tabs vs spaces, Windows vs Unix line endings, or non-breaking spaces pasted from a web page — make lines that look the same actually differ. The character-level highlight will show the difference at the very end or in the middle of the line.
Can I diff two files instead of pasting text?
Yes — drag and drop a file onto either panel to load its contents, then compare as usual.