Guide · 5 min read · Updated 3 August 2026
How to compare two versions of a document and find every change
Reading two files side by side does not work past about a page. Here is what a real comparison does instead.
Someone sends back "the contract, with a few small changes". There is no track-changes markup and no summary. Now you have two files that look the same, and one of them has a different number in it somewhere.
Reading them side by side stops working after about a page. People are very good at confirming that two things look alike. They are very bad at finding the one spot where they differ.
What a real comparison does
A diff algorithm finds the longest common subsequence: the largest set of lines that appear in both documents, in the same order. Whatever is left over is a change. Because of this, a good comparison stays usable when a whole paragraph is added at the top. The tool lines up again on the text both files still share, so it does not report every line after the insertion as different.
Comparison is useful at three levels of detail:
- Line level: which lines were added, removed or replaced. This gives you the overall picture.
- Word level: inside a changed line, which words moved. This is what turns "this line changed" into "thirty days became sixty days".
- Cell level: for spreadsheets, which individual cells differ. Lines mean nothing in a grid.
Comparing PDFs
A PDF has no lines. It only has glyphs placed at coordinates on the page (you can see this in the ISO 32000 PDF specification). So the first step is to rebuild the text, grouping runs into lines by their vertical position. Only then can the diff run.
This has a few effects you should know about:
- A change that is only visual, such as a different font or a shifted margin, will not show up, because the text is the same. Usually that is what you want.
- Layouts with several columns can be read in the wrong order, which creates false differences. Check a suspicious result against the page before you act on it.
- A scanned PDF has no text at all. Run OCR on both files first, and accept that recognition errors will show up as differences.
Our Compare PDF tool extracts both documents on your device and shows a side-by-side diff with line numbers. Long runs of unchanged text are collapsed, so you only read what moved.
Comparing Word documents
Word's own Compare feature is excellent, and you should use it when both files are .docx and you have Word. It falls short when one file is .docx and the other is a PDF, when you do not have Word, or when the documents came from completely different programs.
Compare Word Documents reads the paragraph structure straight out of the .docx and diffs it, highlighting insertions and deletions at word level.
Comparing spreadsheets: a different problem
A line diff is the wrong tool for a spreadsheet, and here is why. Insert one row near the top and every row below moves down. To a text diff, the whole file has changed. It will report five hundred differences, and all of them are the same single difference.
A proper spreadsheet comparison matches up rows first, then compares cells. There are two ways to match them:
- By key column. Match rows on an invoice number, an employee ID or a SKU. Whenever such a column exists, this is the right choice. It copes fully with re-sorting, insertion and deletion.
- By position. Match rows in order, using the same longest-common-subsequence logic so the rows stay correctly lined up when some are inserted or removed.
Once rows are matched, each pair is compared cell by cell. You get "row 47, column Quantity: 12 became 21", which is an answer you can act on.
Compare Excel Files does exactly this. It highlights every changed cell with its old and new value, and it can export a report of the differences as a spreadsheet of its own.
Two settings to understand
Ignore extra spaces. Usually on. Nobody cares about trailing whitespace or two spaces after a full stop, and these cause more false differences than anything else.
Ignore case. Usually off for normal writing, where capital letters carry meaning. Usually on for data, where "ACME Ltd" and "Acme Ltd" are the same company typed by two different people.
Why running it locally is important here
People compare documents most often when those documents are the ones they cannot upload: contracts under negotiation, financial models, drafts under NDA, patient data. Of all the document tools, this is the one where the privacy question is very real.
Every comparison tool on this site reads both files in your browser and runs the diff there. Neither document is sent anywhere, so you can compare a confidential draft without needing anyone's permission.
Tools mentioned in this article
- Compare PDF See exactly what changed between two versions of a PDF.
- Compare Word Documents Track every insertion and deletion between two documents.
- Compare Excel Files Find every changed, added and removed cell between two sheets.
- Compare Text Paste two blocks of text and see the differences instantly.