Compare Two Texts
Line-by-line differences, computed in your browser.
Everything is processed in this tab. Nothing you paste is sent anywhere.
Every tool runs entirely in your browser. Your files are never uploaded to a server.
A diff finds the longest sequence of lines the two versions share, then reports everything else as added or removed. Lines prefixed with a minus are only in the first version, a plus only in the second.
How to use Text Diff
- Paste the first version. The original text goes at the top.
- Add a --- separator. A line containing only three dashes marks where the second version starts.
- Paste the second version. The changed text goes underneath.
- Read the differences. Minus lines were removed, plus lines added, with counts beside them.
About comparing two texts
Comparing two versions of a text is one of those tasks that is trivially easy to describe and surprisingly involved to do well. The naive approach — walk both versions together and report the first mismatch — falls apart as soon as a line is inserted, because everything after it appears changed when nothing was. The standard solution is to find the longest common subsequence: the largest set of lines appearing in both versions in the same order. Whatever falls outside it is reported as removed from the first or added to the second, which produces the smallest sensible description of what happened rather than merely a correct one. This works on whole lines, which is the same granularity version control uses and is a deliberate trade. Changing a single word reports the line as removed and a replacement added, rather than highlighting the word. That is less precise but far easier to scan, and it avoids the noisy output that character-level comparison produces on ordinary prose. The whitespace option matters more than it sounds. Re-indented code, text copied out of a word processor and files that have travelled between operating systems routinely differ in ways that are invisible on screen, and comparing without trimming reports them all. Everything here runs in the browser, which is the practical point: contracts, credentials and unreleased source can be compared without being sent anywhere.
Frequently asked questions
Is my text uploaded anywhere?
Why does a small edit show as a whole line changed?
What does ignoring whitespace do?
How does the comparison decide what changed?
Is there a size limit?
Last updated