Skip to main content
TOP free online tools Your Workbench
English

Compare PDF Files Online

Compare two PDF files or text revisions side by side in your browser. Extract PDF text locally page by page and inspect LCS line diffs with added, removed, and unchanged stats.

Local browser processing — zero server uploads

How to Use

  1. Upload Document A (.pdf) and Document B (.pdf) using the file pickers, or paste text directly into either pane.
  2. Optionally toggle Trim whitespace, Ignore blank lines, or Case-sensitive comparison.
  3. Switch between Visual Diff, Changes Only, and Unified Diff tabs to inspect added, removed, and unchanged lines.
  4. Click Copy Unified Diff to copy the diff patch or Reset to clear both documents.

What is Compare PDF Files Online?

Compare PDF Files Online lets you inspect textual differences between two versions of a PDF document—or two pasted text drafts—directly inside your browser without uploading confidential files. It extracts text streams page by page from both PDFs and highlights added, removed, and unchanged lines alongside similarity statistics and unified diff output.

How It Works

When you select Document A and Document B, `extractPdfTextFromBytes` validates `%PDF` magic bytes and size limits, loads each document via `pdf-lib` (`PDFDocument.load`), decodes Flate-compressed page content streams (with compression-ratio bomb checks and `ToUnicode` CMap font lookups), and extracts text per page. Then `comparePdfTexts` applies optional normalization and runs `computeLineDiff` (Longest Common Subsequence) to render Visual Diff, Changes Only, or Unified Diff views.

Common Use Cases

  • Contract and legal redlines — upload v1 and v2 PDF agreements to pinpoint added clauses, deleted terms, and changed payment figures
  • Policy and compliance reviews — verify revision updates across handbook or specification PDFs using Changes Only mode
  • Financial and invoice audits — compare extracted tabular lines between revised PDF reports while ignoring minor spacing differences
  • Manual text fallback — paste text copied from scanned OCR documents directly into Document A and Document B for instant LCS diffing
Technical Details

Uses `pdf-lib` (`decodePDFRawStream`, `ToUnicode` CMap parsing, `Tj`/`TJ`/`Td`/`Tm` content-stream tokenization), `validateFileSafety` + `checkCompressionRatio` (50 MB max, 200x ratio cap), and LCS `computeLineDiff` + `renderUnifiedDiff`. Includes Visual/Changes Only/Unified tabs, Swap A ↔ B, Sample, Copy Unified Diff, and Reset.

FAQ

Can I upload two PDF files directly to compare them?

Yes. Select Document A (.pdf) and Document B (.pdf) using the file pickers. Both PDFs are parsed locally in your browser via pdf-lib to extract text page by page before computing the line diff.

Are my PDF documents uploaded to any server?

No. PDF parsing, decompression safety checks, text extraction, and LCS diff computation happen 100% locally in browser memory.

What if one of my PDFs is scanned or image-only?

Image-only or encrypted PDFs do not expose embedded text streams. The tool warns you if zero extractable text is found so you can paste OCR or copied text directly into either Document A or Document B.

How does the diff algorithm handle inserted or deleted lines?

It runs a Longest Common Subsequence (LCS) line diff (`computeLineDiff`) rather than naive index comparison, so inserting a paragraph does not mark every subsequent unchanged line as modified.