What this comparison means
SHA-256 detects byte-level differences. PDF.js text extraction helps locate content changes, but it does not prove that two pages look visually identical. The PDF.js engine is loaded from a pinned CDN only after you start.
Formats, sizes and other limits
Two different questions are answered here, and the page keeps them apart. The byte check reads both files as array buffers and runs each through crypto.subtle.digest('SHA-256', …), printing the two hex fingerprints: identical hashes mean the files are byte-for-byte the same, and different hashes prove they are not, even if they look alike on screen. The content comparison then loads PDF.js — fetched from a pinned CDN release after you press the button — opens each document, renders its pages and pulls the text layer from every page with getTextContent(), so you can see page counts side by side and read what the words changed to. The hash is instant and exact; the text view is the part that tells you whether a re-exported contract actually differs in substance.
Where it stops working
A hash proves equality of bytes and nothing more: re-saving the same page in a different writer produces a different fingerprint, while a genuinely altered file will almost never collide. The text comparison only sees words, so a changed logo, a moved signature block, a re-encoded photograph or a swapped stamp can pass unnoticed, and scanned pages have no text layer at all, leaving both sides looking empty. Encrypted PDFs cannot be opened and there is no password prompt. Complex documents take time, because PDF.js parses each file in the tab and renders page images as it goes, and very large files are held in memory twice — once for the digest and once for the renderer — so a pair of heavy scans can exhaust a small device.
Privacy: nothing is uploaded
Both documents are opened with the File API and inspected inside this tab; the hashes and extracted text are produced locally and shown to nobody else. The only outbound request is the PDF.js bundle and its worker, fetched from a public CDN once the comparison starts.
Frequently asked questions
Two files look identical but the hashes differ. Why?
Because PDF writers embed a creation timestamp, a document ID and often a producer string, so exporting the same content twice produces different bytes. Use the text comparison to see whether the actual words changed.
Can it tell me if an image inside the PDF was replaced?
No. The comparison works on bytes and on extracted text, not on pixels, so an edited figure, a new logo or a swapped photograph will not be flagged. Diff the rendered pages with an image tool if that matters.
Why did a scanned document show no text?
Scanned pages carry a picture rather than a text layer, and there is no OCR here. The page count will still be reported, which is often enough to spot a missing page.