Compare Two PDF Files and Find the Text Differences

Comparing two PDFs means extracting the selectable text from both files and reporting which lines appear in only one of them, so you can see what changed between two versions of a document. This tool runs that text comparison entirely in your browser and lists the lines unique to each file. It compares text only - images, fonts, colors, and layout shifts are not detected - and neither file is ever uploaded.

Compare PDFs — runs on your device

How it works

Text in a PDF is not stored as flowing paragraphs. Each page's content stream contains positioned drawing commands — "place these glyphs at these coordinates in this font" — with no inherent notion of words, lines, or reading order. To compare documents, the tool first has to reconstruct lines: both files are parsed with the pdf.js library (the same engine Firefox uses to display PDFs), each page's text items are read via the text-content API along with their coordinates, and items that share a baseline are joined in left-to-right order into a line of text. Repeating this for every page of both documents yields two ordered lists of lines.

The comparison itself treats those lists as sets: each line from document A is looked up among document B's lines and vice versa. Lines found in both are unchanged content; lines found only in A were removed or rewritten; lines found only in B are additions or rewrites. An edited sentence therefore typically shows up twice — the old wording under "only in the first file" and the new wording under "only in the second." Matching by content rather than position keeps the report focused on wording: a paragraph that merely moved to the next page produces no noise.

The scope is strictly textual, and that has two consequences worth internalizing. First, anything that is not selectable text is invisible to the comparison — replaced photos, logo swaps, color changes, and margin shifts all pass silently. Second, both files must actually contain a text layer: a scanned page is one big image, extracts as nothing, and compares as equal to any other scan. If your PDFs are scans, run OCR elsewhere first; this site's PDF to Text tool is a quick way to check whether a file has extractable text at all.

Both extractions and the diff run in browser memory on your machine. For the contracts, offers, and manuscripts this tool is typically used on, that means the content never touches a server.

Worked example: two revisions of a supplier contract

A procurement team received agreement_v4.pdf (18 pages, 640 KB, 1,412 extracted lines) after negotiating changes to agreement_v3.pdf (18 pages, 636 KB, 1,408 lines). The supplier's cover email said only "minor clarifications."

The comparison finished in about three seconds and reported 9 lines unique to v3 and 13 unique to v4. Most pairs were the expected clarifications, but two findings justified the check: the line "Liability is capped at the total fees paid in the preceding 12 months." appeared only in v3, while v4 contained "Liability is capped at fees paid in the preceding 3 months.", and v4 gained a brand-new automatic-renewal clause that no old line corresponded to. A 22-word change in 36 pages of combined text — precisely the kind of edit that skimming misses and a line diff cannot.

Frequently asked questions

How can I see what changed between two versions of a PDF?

Load both versions into this tool and it extracts the text lines from each file and lists the lines that exist in only one of them. Lines present only in the newer file are additions, and lines present only in the older file were removed or rewritten.

Does this comparison detect changes to images or formatting?

No. The comparison works on extracted text lines only, so a swapped photo, a changed font, or a recolored heading produces no difference as long as the words are the same. Visual comparison requires rendering both files and diffing pixels, which this tool does not do.

Why does comparing two scanned PDFs report no differences?

A scan is a picture of a page, and unless OCR has been run there is no selectable text for the tool to extract, so both files yield empty text and appear identical. Run OCR on both scans first, then compare the OCR results.

Will a moved paragraph show up as a difference?

No, not if its wording is unchanged, because lines are matched by content rather than by position or page number. This makes the tool good at answering what text changed and unsuitable for proving that layout or pagination stayed the same.

Can I compare two contracts without uploading them anywhere?

Yes. Both files are parsed by JavaScript inside your browser tab, and the text extraction and comparison happen in your device's memory. No part of either document is transmitted, which matters for exactly the confidential drafts people most often need to compare.

Why do some identical-looking lines get flagged as different?

PDF generators sometimes re-encode text between versions, changing invisible details such as hyphenation points, ligatures, or spacing characters, so the extracted strings differ even though the print looks the same. Treat such flags as a prompt to inspect that line in both files.

Related tools