How comparedocuments.app compares documents on your device
The evidence behind the claims on the document comparison tool: how the text is read from Word files and PDFs, how the two versions are lined up and compared, how moved text is found, what the downloads contain, the limits, and how to check that your files stay on your device.
Updated
What happens to your files
A file you add is read by code that is already part of the page, in a background worker in your browser. Its kind is decided by its contents, not its name. Word files are read with mammoth 1.13.0 and parse5 8.1.1, PDFs with pdf.js (pdfjs-dist 6.5.438), the comparison is made with jsdiff (diff 9.0.0), and the Word redline is written with docx 9.16.0. All are open-source libraries, served from this site and run in your browser, so no server takes part.
When you change an option, the text already read from the two files is compared again; the files are not read a second time. For a PDF, the text is kept both with and without its repeated header and footer lines, so that option works the same way.
How the text is read from a Word file
A .docx file is a ZIP archive. The tool's own code opens it and unpacks only the parts that hold text (the document, its lists and styles, footnotes, endnotes and comments) and the lists that tie them together; pictures and embedded or linked files are never unpacked or fetched. mammoth turns those parts into HTML, and parse5 reads that into a list of blocks: headings with their level, paragraphs, list items with their depth, table rows with their cells, and footnotes and endnotes. Text that is a tracked insertion is kept and text that is a tracked deletion is dropped, so the file is read as if its changes were accepted, and a note under the sheet says so.
Comments, headers and footers, text boxes and pictures are left out, and a note says so when the file has any of them. An old .doc file is recognized by its file header and gets a message to save it as .docx. A ZIP file that is not a Word document, such as an Excel workbook, gets the message "Choose a Word (.docx), PDF, or plain text file." A Word file whose XML declares a document type or an entity, as some hostile files do, is refused with the message "This document could not be read. Save a new copy and try again."
How the text is read from a PDF
pdf.js gives the text of each page as pieces with their positions. The tool groups the pieces into lines by their baseline, reads a page as two columns when its lines fall on both sides of the middle and share baselines, and joins lines into paragraphs by line spacing and indent. A word that a hyphen broke at the end of a line is joined again. Lines near the top or bottom of the page that repeat at the same height on more than half of the pages, such as running headers, footers and page numbers, are removed while Leave out repeated page headers and footers is on. It is on unless you turned it off on an earlier visit, and it appears under Comparison options on the PDF page, and on the other pages once a PDF is added.
A PDF that needs a password gets a message. A PDF with no text at all, such as a scan, gets a message that the tool does not read pictures of text, and when only some pages have no text, the note "Some pages have no readable text." appears, without naming the pages. Fonts, colors, images and the position of the text on the page are not compared.
How the two versions are lined up and compared
A comparison starts by lining up the blocks of the two versions, so that one inserted paragraph does not make every later paragraph look different. Three passes do this:
- Same text. Blocks whose text is the same in both versions, after the options you chose (such as ignoring case), are matched.
- Same order. Among the matches, the largest set that appears in the same order in both versions is kept (the longest common subsequence), so the rest of the document stays lined up around an insertion or a deletion. For a very repetitive pair of documents, a faster method is used that may keep fewer matches.
- Changed blocks. Between two matched blocks, each unmatched block of the original is paired with the first unmatched block of the revised version, among the next 32, whose words are at least half the same. The pair is shown as one changed block, and the revised blocks it skipped as added. An original block with no such partner is shown as removed.
With Ignore spaces and line breaks on, blocks are also matched when one version splits the same text into more blocks than the other. A heading whose text is the same but whose level changed is shown as a changed block, with a note such as "Heading 1 → Heading 2".
Inside each changed block, the words (or the characters, with Compare by set to Characters) are compared with jsdiff, and the ones that differ are marked. The percentage in the summary line is the share of the words in both versions that were neither added nor removed, rounded to a whole percent.
How moved text is found
With Detect moved text on, a block shown as removed and a block shown as added somewhere else are paired as one move when both are at least 8 words long and their text is the same, after the options you chose, or at least 90 percent of their words are the same. The tool looks for the same text first, then for the most alike of up to 256 added blocks that share words with it. Both ends have a dashed underline, "↔" in the margin and a link to the other end, and the pair counts as one change.
Shorter blocks, and text moved within a paragraph, are not detected as moved: they show as removed in one place and added in the other, or as changed words inside the paragraph. A block that the third pass above paired as a changed block is not checked for a move.
What the downloads contain
Download redline (Word) writes a new Word file, redline.docx, in which each change is a real tracked change (Word's own insertion and deletion marks, and a tracked style change for a heading whose level changed), all by the author "comparedocuments.app". A moved block is written as a deletion where it was and an insertion where it is now. Accepting all the changes gives the revised text and rejecting all of them gives the original: the tests read the file's XML and check both, character for character, and macOS's textutil must open the file without an error.
The Word file carries the text, with headings at their level and list items as bulleted items at their depth, numbered lists included. Each table row is written as one paragraph with a tab between its cells, not as a table, and footnotes come at the end as ordinary paragraphs. Fonts, styles other than the heading styles, page layout, headers and footers and pictures are not carried over.
Download redline (HTML) writes one web page, redline.html, with its styles inside it and no script. At its top it shows the names of the two documents and the date. Removed text is marked as deleted and added text as inserted, and each moved block has a "Moved" link to its other end; a test counts those marks against the summary. Print / Save as PDF prints the Redline view, with every row, whatever view is open, in black with the marks kept. Download change list (CSV) writes changes.csv, with one row per change (one for each moved pair): its number, kind (insert, delete, change or moved), page, original text and revised text. A cell that begins with =, +, - or @ gets an apostrophe in front, so a spreadsheet does not run it as a formula.
How it is tested
Engine tests read and compare documents whose contents are known, and the text read and the changes found must be exactly the ones expected: a paragraph added, removed, changed and moved, a changed table cell, a heading whose level changed, a list, a footnote, a Word file with tracked changes, a comment and a header, a two-column PDF, a PDF with running headers, page numbers, hyphenated words and an empty page, a Word file against a PDF of the same text, Hebrew and Chinese text, and a pair of 300-page PDFs. Every test file is made when the tests run: Word files with the docx library, PDFs with Ghostscript.
For the main Word and PDF test files, the text the tool reads is checked against what two programs that have nothing to do with this site read: macOS's textutil for Word files and pdftotext from poppler for PDFs. Damaged and wrong files must each give their own error: an empty file, an old .doc, an RTF file, an Excel file, a ZIP that is not a Word file, a Word file that declares an entity, a cut-off Word file, a cut-off PDF, a scanned PDF, a password-protected PDF, a file over 100 MB, a PDF of 3,001 pages and a text of more than 1,500,000 words.
Browser tests drive the tool with a script: a Word pair, a PDF pair and a Word file against a PDF, pasted text on both sides, each view with next, previous, the N and P keys and Changes only, each option, the four downloads and Copy summary, Swap, the messages for an old .doc, a scan, a password-protected PDF, a wrong file and a damaged file while the other sheet keeps its file, the 300-page pair, the tool offline, the narrow and wide layouts in both color themes, and the network test described below.
Last tested: November 22, 2026. Result: the 10 engine tests passed, and the 12 browser tests passed in Chrome, in Firefox and in WebKit, the engine of Safari.
Known limits
A file can be up to 100 MB, 3,000 pages and 1,500,000 words, and pasted text up to 1,500,000 words; a larger one gets a message instead of a result. A Word file whose unpacked parts pass 100 MB, or hold more than 2,000,000 XML elements, gets the same message. The word-by-word pass inside a changed block stops when the pair is longer than 120,000 characters, has too many edits or takes more than a quarter of a second. Such a block is shown whole, as removed and added, and the line "Some long edits are marked as whole paragraphs." appears under the summary.
The tool does not read scanned PDFs without a text layer (it has no OCR), old .doc files, password-protected PDFs or Word files, RTF files, Excel workbooks or PowerPoint presentations. In Word files it leaves out comments, headers and footers, text boxes and pictures, and it reads tracked changes as accepted. It does not compare formatting, images or layout, and of the structure it reports only a change of heading level.
PDF text is put in reading order by its position on the page, as one column or as two columns split at the middle. Pages with three or more columns, columns of different widths or rotated text can be read out of order, and that shows as changes. A paragraph that runs onto the next page is read as two parts. A hyphen at the end of a line is always removed when the next line starts with a letter, so a word such as "well-known" that breaks at its hyphen in one PDF and not in the other shows as a change.
In the Word redline, table rows are paragraphs with a tab between the cells, numbered lists become bulleted lists, and the formatting of the files you compared is not carried over. In a heavily rewritten document with many similar paragraphs, the limits on matching can show a move as a removal and an addition.
The comparison reports differences in the words. It is not legal advice, and it is no substitute for reading a contract, or any other document, before you sign it or send it.
Not tested yet: phones, opening the Word redline in Microsoft Word itself (the tests use textutil and their own XML reader), and Word files saved by Word or PDFs made by other programs (the test files are made by the docx library and Ghostscript).
How to check that nothing is uploaded
You do not have to take this on trust. Three checks, from quickest to most thorough:
- Go offline. Load the tool, turn off Wi-Fi, then compare two files. It works, which it could not do if the files had to reach a server.
- Watch the network. Open your browser's developer tools, go to the Network tab and add two files. The page fetches its own code from comparedocuments.app and, if analytics is on, loads the Google Analytics script and sends small requests to Google Analytics. None of them contains your files, their names or their text.
- Read the security policy. Every page is sent with a Content-Security-Policy header that tells the browser to block the page from sending data anywhere except comparedocuments.app and Google Analytics.
Before each release, a browser test compares a Word file and a PDF with a marker in both file names and in the text of both documents, pastes text with a marker in it on both sides and raises an error with a marker in its message, while Google Analytics runs. A marker in any request, any request to another server, or any request to a session recorder fails the test.
There is no session recording on this site, because a recorder captures what the page shows, and this page shows the text of your documents. The privacy page lists what Google Analytics receives.