Skip to content
Document Diff
Original document
Changed document
Text extracted and compared locally.

PDF & DOCX Document Diff

Compare PDF and Word documents change by change — free, private and running entirely in your browser

Original document and Changed document each hold one file. pdf.js reads a .pdf, mammoth raw text reads a .docx, and file.text() reads every other accepted name. Matching starts when the second extract exists.

Last updated: 11 October 2026

Guide, examples, and FAQ

About Document Diff

What it does

The picker accepts .pdf, .docx, .txt, .md, .log, .csv, .json, .xml, and text files. .docx uses mammoth extractRawText. .pdf uses pdf.js, each page prefixed “— Page N —”, with a line break only on an end-of-line item. No password field, no encoding menu, no size cap. Other names, including .doc, use file.text(). Cleanup uses line feeds, drops trailing spaces and tabs, collapses three or more blank lines to two, and trims.

Who it is for

For two PDF exports, two .docx drafts, or a PDF beside a .txt.

When to use it

When both revisions are files. Swap exchanges the two documents.

Key features

  • PDF page headings

    Each pdf.js page begins with “— Page N —”.

  • DOCX raw text

    mammoth extractRawText leaves out fonts, images, comments, and tracked changes.

  • Words inside a modified line

    A removed line next to an added line is one modification. Word tokens mark the piece that changed.

  • Split and three lines of context

    Split is the default. Unified is one column. Collapse unchanged keeps three matching lines around a change.

  • Markdown counts

    Report writes sizes plus Additions, Deletions, Modifications, and Unchanged. No lines and no copy button.

How to use Document Diff

  1. 1Choose or drop one file into Original document.
  2. 2Choose or drop the second file into Changed document.
  3. 3Read +added, −removed, ~modified, and unchanged. The first three at 0 means the documents match.
  4. 4Leave Ignore whitespace on unless a leading indent should count. Ignore case starts off.
  5. 5Download Report, or Save the names and counts in memory for this visit.

Example

Before

Hello world
Second line

After

Hello there
Second line
Third

modified 1 · unchanged 1 · added 1 · removed 0

Row 1: world removed, there added, Hello equal. Row 2 is Second line. Row 3 adds Third. Hello world is 1 modification. Hello against hello is 1 modification with Ignore case off.

Benefits

  • 12 becomes 18

    “The supplier shall deliver 12 units within 30 days of the order date.” / “Payment is due on delivery.” / “Either party may end this agreement with 14 days written notice.” Changed side: 18 units, then the notice sentence. modified 1, removed 1, unchanged 1, added 0. Token 12 is removed and 18 is added.

  • Beta is deleted, then added

    Alpha paragraph stays. / Beta paragraph moves. / Gamma paragraph stays. against Alpha, Gamma, Beta: added 1, removed 1, modified 0, unchanged 2.

Common use cases

  • Two PDF exports

    “— Page N —” plus the pdf.js text items are the matched strings.

  • A .docx and a .txt

    mammoth raw text on the .docx side, file.text() on the .txt side, after the same cleanup.

Tips & best practices

  • Keep plus “ Hello”, against Keep plus Hello, is unchanged 2 with Ignore whitespace on, and both columns show Hello. Off, it is modified 1 and the two spaces are deleted.

Common mistakes to avoid

  • Scanned body, no OCR. Headings-only files warn “No extractable text found in {name}”. Documents match hides if either has no text.
  • Expecting fonts, images, comments, tracked changes, or header and footer styling.
  • Reading the Hello world row as a whole-line replacement. Only world and there are the marked tokens.
  • Expecting Save to keep the PDF or DOCX. It keeps names and counts in memory for this visit.

Frequently asked questions

What can each slot open?

One file. .docx uses mammoth, .pdf uses pdf.js, and .doc uses file.text().

How does pdf.js split a page?

After “— Page N —”, an end-of-line item breaks the line. Any other item is followed by a space.

When does the empty-text toast appear?

“No extractable text found in {name}” only when the whole extract is blank. The file still loads. A locked PDF toasts “Failed to read {name}”.

Does Ignore whitespace ignore a double space?

No. It trims a line for the line match only. Word tokens skip it, so Hello world stays 1 modification.

Does Ignore case change Hello against hello?

Off, it is 1 modification. On, it is unchanged, both columns show hello, and the same switch applies to word tokens.

Does Report include the changed lines?

No. The .md file has names, sizes, Additions, Deletions, Modifications, and Unchanged.

Does Save keep the two files?

No. Memory holds the names and the added, removed, and modified counts. Restore asks you to reload them.

Does this page upload the PDF or DOCX?

No. The bytes stay in the browser. The page makes no network request.

When another tool fits better

  • Text Diff. The wording is already pasted and you want a unified patch file.
  • Excel Diff. The files are .xlsx, .xls, or .csv and the unit is a cell.

Conclusion

Hello world against Hello there, with Second line kept and Third added, is modified 1, unchanged 1, added 1, removed 0.

Ready to try Document Diff?

Scroll back up to start now, or continue with another free diff tool.