By Tim King · Updated
Compare PDF Files
Find Differences Between Two PDFs, Line by Line With Page Numbers
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Compare PDFs works
Compare PDF files to see exactly what changed between two versions of a contract, report or policy. Choose the original and the new copy, and every added and removed line is listed with its page number. Both files are read in your browser and never uploaded.
A contract comes back from the other side "with a few small edits". A supplier sends version 3 of their terms. A colleague updates a policy and forgets to turn on tracked changes. Reading two 40-page documents side by side to spot one changed figure is slow and easy to get wrong, and the edit that matters is usually the one you miss.
How to compare PDF files
- Choose both PDFs at once, the original first and the changed copy second. On most systems you can hold Ctrl or Cmd and click each file in order.
- Pick Changes only to list just the differences, or Whole document to see them in context.
- Read the result, or download it as a text report.
Lines starting with + are new in the second file and shaded green. Lines starting with - were
in the first file and are gone, shaded red and struck through. A changed line shows as one removal
followed by one addition. The p3 label is the page the line sits on.
How it works
Each PDF is opened with pdf.js, Mozilla's open-source PDF reader, and its text layer is pulled out page by page. Text in a PDF is stored as positioned fragments rather than lines, so fragments that share a baseline are joined into a line, and spacing is normalised so that a re-flowed space does not count as a change.
The two lists of lines are then compared with a longest common subsequence algorithm, the same
idea behind diff and Git. It finds the largest set of lines that appear in both documents in the
same order, and everything else is reported as added or removed. Matching lines at the start and
end are skipped first, so documents with a few edits compare quickly however long they are.
What it compares and what it does not
| Compared | Not compared |
|---|---|
| Wording, numbers, dates and names | Fonts, sizes, colours and bold or italic |
| Added and deleted paragraphs | Images, logos, charts and signatures |
| Text in tables, headers and footers | Layout, margins and page breaks |
| Moved text, shown as a removal plus an addition | Scanned pages with no text layer |
This makes it a content check rather than a visual one. It answers "did the words change?", which is the question that matters for contracts, quotes and policies, and ignores a new letterhead or a re-flowed page.
Tips and pitfalls
Order matters. The first file is treated as the original. If every addition looks like a removal, the files were picked the other way round; choose them again in the opposite order.
Small edits show as whole lines. If one word in a long line changed, the whole line is listed as removed and added again. Read the pair together to spot the difference, or paste both lines into the Text Diff tool for a word-by-word view.
Re-exported files can look very different. A document saved from Word and the same document printed to PDF may break lines in different places, so many lines show as changed even though the wording is identical. Compare files produced the same way where you can.
Scans have no text. A scanned page is a picture, so there is nothing to compare. If a file returns no lines, it needs OCR first.
Very long, very different files are refused rather than freezing the tab. Compare a chapter or a range of pages at a time, using the PDF Page Extractor to cut them out.
Password-protected files must be unlocked first.
Reading the result
Pages shows the page count of the original and the new file. Lines added and Lines
removed count the differences, and Unchanged lines counts the text the two share. If both
counts of differences are zero, a note confirms the text is identical. The downloaded report
starts with --- and +++ lines naming the two files, like a standard diff.
FAQ
Can I compare two PDFs for free without uploading them?
Yes. Both files are opened and compared by JavaScript in your browser tab, so contracts and reports never leave your computer, and there is no sign-up, file size fee or watermark involved.
Does it show changes in images or formatting?
No. It compares the text layer only: wording, numbers, dates and names. Changes to images, fonts, colours or layout are not detected, so check those visually if they matter for your document.
Why are lines shown as changed when the text looks the same?
Usually the line breaks moved. If a paragraph was re-flowed, the same words are split across lines differently. Spacing is ignored, but a different break point still counts as a changed line.
Can it compare a scanned PDF?
Not directly. A scanned page is an image with no text layer, so there is nothing to compare. Run the scan through an OCR tool first so it has searchable text, then compare the result.
See also: all PDF tools, Images, Audio, Video & Screen, SVG, Simulations & Screensavers, Generative Art, Chart Makers, 3D Model Viewers, Drawing Pads, Mockups & 3D Making, Diagram Makers, 3D Science, Tracker Music.
Related tools
PDF Text Extractor
Extract the text layer from a PDF, privately, in your browser.
Text Diff
Compare two texts and see exactly what changed.
PDF Merger
Combine PDFs into one file in your browser: nothing uploaded, pages in any order.
PDF Page Counter
Count PDF pages and find which ones are the heaviest.
Unlock PDF
Remove the password and restrictions from a PDF you can open.