pdftoolskit.org
65 PDF tools that run in your browser
Sign in Create account

PDF Text Diff: Compare the Words

line or word granularity · removed in red, added in green · .diff download

Add the old and the new PDF and click Diff the text. The text layer of each is grouped into lines, the two sequences are aligned with a longest-common-subsequence diff, and the result is shown as removed and added lines with a .diff file to download. Both files stay in your browser.

Drop exactly two PDFs here

First file = original · second = revised

    no files
    Ready.

    Need test files? Compare sample-1-page.pdf with sample-10-pages.pdf: the body paragraphs are identical, so only the heading, the "Page N of M" line and the nine extra pages differ.

    How the comparison works

    Reading the output

    Blind spots

    A text diff sees words, not appearance. A changed logo, a different font, altered spacing or a new colour is invisible to it; PDF compare diffs the rendered pixels instead. A scan has no text layer: if neither file has one the tool stops with an error, and if only one has been through OCR, its recognition errors show up as differences.

    How to compare the text of two PDFs

    1. Drop the two PDFs, the old version first, then the new one.
    2. Choose the granularity: Lines for a compact view, Words when a sentence was edited and you want the exact words.
    3. Set the context lines (0 to 20) to include around each change in the .diff file.
    4. Click Diff the text and read the red and green lines.
    5. Download the .diff to attach to a review or an email.

    FAQ

    Line or word granularity?

    Start with lines. Switch to words when a paragraph was reworded and the line view shows the whole thing removed and re-added; word mode then marks only the changed words.

    Why does it report differences between documents that read the same?

    Line grouping. Two producers can place the same text at slightly different vertical positions, or split a superscript or a table cell into its own item, so the lines are built differently and no longer match. The percentage of such noise is usually small, and word mode reduces it further.

    Can it compare a scan?

    Not directly, since a scan has no text layer. Run OCR PDF on it first, and expect OCR mistakes to appear as changes.

    Is there a size limit?

    The exact alignment is used while lines-in-A times lines-in-B is at most 4,000,000, for example two files of 2,000 lines each. Above that the tool compares line by line by position, which still lists every difference but no longer realigns around insertions.

    Related tools

    Part of: Review a revised document

    Run both diffs. The text diff tells you what the words say now; the visual diff catches a moved logo, a changed chart or a font substitution the words cannot show.

    1. 1 PDF Text Diff Added and removed lines between the two versions
    2. 2 Compare Two PDFs Pixel differences painted over the faded original, page by page
    3. 3 Extract PDF Highlights Pull every highlight and comment out as Markdown, CSV or JSON
    4. 4 Edit PDF Metadata Check who saved it and when

    This workflow, start to finish · all 20 workflows