Two versions of a contract differ somewhere. The question is never whether — it is where, and how much. Reading two documents side by side hunting for a changed clause is slow and unreliable, because the eye is a bad diff engine: it skims, it assumes, it misses the one word in paragraph nine that turned "may" into "must". This tool does the mechanical part properly. It extracts both documents' text, aligns them paragraph by paragraph, and shows you exactly what is the same, what changed — down to the word — and what exists on only one side. This guide explains the method, how to read the score, and the limits worth knowing before you rely on the result.
How to compare two documents, step by step
PDFs are read page by page on your device; watch the line under each upload area, which reports how many words and paragraphs were extracted. That number matters: if a 30-page PDF reports 40 words, it is a scan with no text layer, and no comparison tool can help until it has been through OCR. When both sides report sensible word counts, the comparison itself takes seconds for ordinary documents.
Order matters in one respect only: A is treated as the original and B as the revision, which decides the direction of the highlighting — struck-through words are what B removed, green words are what B added. Swap the documents and the same comparison reads in reverse. If a document is password-protected, remove the password first with the PDF Password Remover if you know it; this tool never asks for one.
How the comparison works under the hood
First, text extraction: pdf.js — Mozilla's PDF engine — pulls each PDF's text out page by page in your browser, and paragraph breaks are reconstructed from the spacing between lines. Pasted and .txt text is split on blank lines. Either way, both documents end up as lists of paragraphs, with internal spacing normalised so that a paragraph reflowed by a different editor still reads as one block of words.
Then, alignment. Each paragraph is reduced to the set of its content words — filler words removed, forms reduced to roots, so "policies" and "policy" count as the same word. Every paragraph of A is scored against every paragraph of B by overlap: the words they share divided by the words they jointly use. Working through A in order, each paragraph claims its best-scoring unclaimed partner in B. A pair sharing at least about a third of their combined content words counts as a match — identical text is a same pair, anything less is a changed pair. Paragraphs that find no partner above the threshold are reported as existing on only one side.
Finally, inside each changed pair, a word-level diff runs: the longest common sequence of words between the two versions is found, and everything outside it is marked — deletions from A, insertions in B. That is the same family of algorithm (longest common subsequence) that programmers' diff tools have used for decades, applied at the grain prose actually changes at: the word.
A worked example, with the arithmetic shown
Scores are easier to trust when you can recompute them. This pair is deliberately tiny — two paragraphs each — and every number below is the output of this page's own comparison code, checked by hand. Document A, paragraph 1: “Alpha bravo charlie delta.” Paragraph 2: “Red green blue yellow.” Document B, paragraph 1: “Alpha bravo charlie echo.” Paragraph 2: “Red green blue yellow.”
Each paragraph is reduced to its set of content words. A¶1 is {alpha, bravo, charlie, delta}; B¶1 is {alpha, bravo, charlie, echo}. They share three words — alpha, bravo, charlie — out of five distinct words between them, so their overlap is 3 ÷ 5 = 0.60. That clears the matching threshold of about a third, and because the texts are not identical, the pair is classified changed. A¶2 and B¶2 are word-for-word identical, so they pair at 1.00 and are classified same.
The headline score is the sum of the pair overlaps divided by the paragraph count of the larger document: (0.60 + 1.00) ÷ 2 = 80%. The counts line reads: Same 1, Changed 1, Only in A 0, Only in B 0. Change one word in B¶2 as well — “yellow” becomes “purple” — and that pair drops to 0.60 too, and the score falls to 60%: the arithmetic has no hidden terms, no weighting by paragraph position, and no credit for paragraphs that merely share a topic.
The word-level view works the same way on real prose. Take A: “the fee is fifty dollars” and B: “the fee is sixty dollars”. The longest common word sequence is “the fee is … dollars”, so the display weaves the two into one line, with fifty struck through as removed and sixty marked as added — in the results panel the same two words are tinted red and green. Nothing else is marked, because nothing else changed.
And the limiting case: give B a paragraph about a completely different subject — “Zulu yankee xray whisky” — and it shares no content words with anything in A. Its overlap with every A paragraph is 0, below the threshold, so it appears in Only in B; the A paragraph it displaced appears in Only in A; and both contribute nothing to the score. Only-in paragraphs are not an error state — they are how the tool reports additions, deletions, and rewrites too heavy to pair.
Real documents add two wrinkles this toy pair avoids. Paragraphs are matched greedily in A's order, so if B contains two similar paragraphs, A¶1 takes the better-scoring one and A¶2 must make do with what remains. And a paragraph repeated many times — a disclaimer on every page, say — pairs each occurrence with one occurrence on the other side, which is why the Same count can be large even in a heavily edited document. Neither wrinkle changes the arithmetic above; both are worth knowing when a pairing looks odd.
The other limiting case is identity. Compare a document with itself and every paragraph pairs at 1.00, the counts read Same n, Changed 0, Only-in 0, and the score is 100% — a useful sanity check if you ever doubt the pipeline, because any other result with identical inputs would expose a bug. Real near-duplicates behave almost as predictably: a one-word change in one paragraph of fifty moves the score by a fraction of a point, which is why the Changed list, not the headline number, is where a careful reader spends their time.
Reading the results: same, changed, and only-in
Start with the headline numbers, which describe the shape of the revision before you read a word of it:
| Similarity | What it usually means | How to read the detail |
|---|---|---|
| 95–100% | A light touch: corrections, a clause or two, formatting churn | Skim the Changed list; check the Only-in lists for a stray addition |
| 80–94% | A real revision: several sections edited, some material added or cut | Read every changed pair; the Only-in lists show the structural changes |
| 50–79% | A heavy rewrite, or two drafts of the same document at different stages | Work section by section; expect rewritten paragraphs to appear as only-in pairs |
| Below 50% | Different documents, or a near-total rewrite | Question whether these are the two versions you meant to compare |
The Changed section is where the substance lives — read those pairs closely, because a one-word change can carry the whole legal or financial weight of a revision. The Only in A list is what the revision deleted or rewrote beyond recognition; Only in B is what it added. Read those two lists together: a paragraph in one and a similar-topic paragraph in the other are usually the same passage before and after a heavy rewrite. The Same list is shown for completeness and audit — most of the time you will only check its count.
What the similarity score does — and doesn't — mean
The score is computed as the sum of every pair's overlap, divided by the paragraph count of the larger document: identical pairs contribute fully, changed pairs contribute their overlap fraction, unmatched paragraphs contribute nothing. It answers one question precisely — how much of these two texts is shared? — and no other question at all. It does not say the documents are equivalent in meaning: swapping "shall" for "may" throughout a contract changes almost no words and almost everything about the obligations. It does not detect plagiarism, authorship or copying; two documents about the same subject written independently will share vocabulary, and a paraphrase can carry copied ideas in fresh words that score low. And it is not a quality score — a revision can be better at 70% or worse at 98%. Treat the number as a triage instrument: it tells you how much reading the detail sections will take, and roughly how far apart the versions are. The detail is the evidence; the score is the map.
The word-level highlighting in changed paragraphs
Each changed pair is displayed as one woven paragraph. Words with a red tint and a line through them were in A and are absent from B. Words with a green tint were added in B. Untinted words are the common spine — the longest sequence both versions share, in order. This reads the way tracked changes reads, and for the same reason: the fastest way to understand an edit is to see the sentence with the edit inside it, not two paragraphs side by side that you must collate mentally.
Two reading tips. First, a moved phrase shows as a deletion plus an insertion of the same words — the algorithm matches sequences in order, so reordering inside a paragraph looks like a small rewrite; the words themselves tell you it was only a move. Second, very long changed paragraphs fall back to a simpler marking — words present on only one side are highlighted without sequence matching — because the exact algorithm's cost grows with the square of the paragraph length. The result is slightly less elegant and still accurate about which words differ.
How paragraphs are rebuilt from a PDF
Pasted text and .txt files arrive with their paragraph breaks intact — the tool simply splits on blank lines. A PDF has no paragraph breaks to read: it has lines of positioned text. So for PDFs the tool reconstructs paragraphs from the geometry of the page. It notes the vertical position of every line, measures the gaps between consecutive lines, and takes the typical (median) gap as the normal line spacing. Where a gap is more than one and a half times that typical spacing, a paragraph break is inferred — the same visual cue a human reader uses.
Two consequences follow. First, a paragraph that runs across a page break is rejoined only if the spacing says so; a page turn with a wide gap can split one logical paragraph into two, which slightly changes the counts without changing the classification much. Second, documents whose paragraphs are separated by indentation rather than blank space — many legal documents — can arrive as one long block per page. The tool guards against giant blocks: any paragraph longer than about 110 words is re-cut at sentence boundaries into chunks of at most three sentences or roughly 100 words, so alignment still works at a readable grain. The same guard applies to pasted text — a wall of text pasted without blank lines becomes a single block, and the chunking rule is what turns it back into comparable units, which is why pasting with paragraph breaks preserved, straight from the source document, gives the cleanest comparisons.
Multi-column layouts are the honest weak point. pdf.js returns text in the order it was laid down in the file, which for two-column PDFs can interleave the columns; the reconstructed paragraphs then mix two threads of text, and their overlaps score oddly. If a PDF comparison looks wrong in a way a .txt comparison of the same text does not, extraction order is the first suspect — the counts at the top of each side's panel (words and paragraphs extracted) are the quickest diagnostic.
A display limit follows from the same practicality. On a very large comparison, each results section — Changed, Only in A, Only in B, Same — shows at most 60 paragraph cards on screen, so the page stays usable; the headline counts always cover the whole comparison, and the downloaded report lists every changed and only-in paragraph in full. If the counts and the cards ever seem to disagree, the report is the complete record.
The honest limits: text layers, reordering, boilerplate
The limits follow from the method, and they are stated here rather than discovered by you. Text layer only: scanned or image-only PDFs have nothing to extract; the tool warns when a document comes back nearly empty, but it cannot OCR. Text only: a change carried purely by formatting, images or layout is invisible — if the words match, the tool says they match. Threshold effects: a paragraph rewritten past roughly two-thirds new wording falls out of the changed list into the only-in lists; that is a deliberate choice, because the alternative — pairing paragraphs that merely share a topic — produces worse errors. Repeated boilerplate: matching is greedy and in order, so among many identical paragraphs (headers, disclaimers, standard clauses) the specific pairings may differ from the ones you would choose, though the classification stays right. Extraction order: multi-column PDFs occasionally extract in a jumbled reading order, which can split or merge paragraphs oddly; the counts and the same/changed structure remain broadly trustworthy, but check an odd-looking pair against the original. And for finding one fact rather than comparing versions, the sibling tool — PDF Question Answering — is the sharper instrument.
Paragraph comparison vs the Text Diff Checker
This site has a sibling, the Text Diff Checker, and the difference is the unit of comparison. The Diff Checker works line by line: exact, unforgiving, and right for code, configuration and short texts, where a moved line genuinely is a change and every character counts. This tool works paragraph by paragraph: it opens PDFs, tolerates reflowed and relocated paragraphs, classifies the outcome as same / changed / only-in, and summarises it with a score. Prose lives in paragraphs; code lives in lines. Comparing a contract with a line diff drowns you in false changes from reflow alone, and comparing code with a paragraph tool would miss the point entirely. Use the grain that matches the material.
If what you need is neither, the rest of the cluster covers the neighbouring jobs: the Document Summarizer shortens one document to its key sentences, and the PDF to Word Converter turns a PDF into editable text when the real task is to revise it yourself.
Sources & References
- pdf.js — Mozilla — the PDF engine (v3.11.174) that opens both PDFs and extracts their text, page by page, in your browser.
- Wikipedia — Diff — background on file comparison and the longest-common-subsequence family of algorithms behind the word-level highlighting.
- MDN Web Docs — FileReader API — how the page reads your PDF and text files locally, on your own device.
- MDN Web Docs — Clipboard API — the browser API behind the Copy Summary button.
- pdf.js — GitHub repository (Mozilla) — the source and documentation of the PDF engine this tool runs in your browser.
- Wikipedia — Jaccard index — the overlap measure used to pair paragraphs: shared content words divided by the words the pair jointly uses.
- Wikipedia — Longest common subsequence — the algorithm family behind the word-level highlighting inside changed paragraphs.