Browser-based PDF tool · PDF → Smaller PDF

Compress PDF

Shrinks a PDF by re-encoding its photos and scans at a lower resolution, merging duplicate fonts and images and dropping unused data, while the text stays selectable.

Input

PDF files (.pdf), up to 50MB each

Drop your PDF file here or click to choose

.pdf

Runs as soon as a file is chosen; change an option to run again.

Files are processed on your device with nothing uploaded. Close the tab and they are gone.

Result

Smaller PDF, ready to download

Choose a file to see the result here.

Compress PDF

Operator: Abdulla Al Fahad. How tools are built and checked

Most oversized PDFs are heavy because of their pictures: phone photos placed at full camera resolution, pages scanned at 300 or 600 DPI, screenshots pasted in by the dozen. Compress PDF measures how large each picture is actually printed and re-encodes it as a JPEG at about 150 DPI of that size with quality 0.75 (Recommended) or 96 DPI with quality 0.55 (Strong). Every level also merges duplicates, drops unused objects and compresses raw streams without loss, and Light does only that, leaving every pixel alone. Pages are never turned into pictures, so the text stays selectable and searchable.

The first pass runs the moment a PDF is chosen, at Recommended with the metadata checkbox ticked, and every change of option repeats it on that same file; the photos are re-encoded on a canvas in the tab and the smaller copy is built there, so a confidential report is never sent anywhere. The download keeps the original's name with -compressed added, and the chips report the percentage saved, the images recompressed and the duplicate objects merged. A result less than 2% smaller, or one that does not reopen with the same page count, is discarded, and your original comes back with a sentence saying so.

Key features

  • Light (lossless clean-up only), Recommended (images at 150 DPI, JPEG quality 0.75) and Strong (96 DPI, quality 0.55).
  • Resolution judged per image from the largest size the pages draw it at, along its less detailed direction, with a 2000- or 1400-pixel cap for images no page content draws.
  • Safeguards: a re-encoded image must be 10% smaller to be kept, and the whole file 2% smaller and able to reopen with the same page count.
  • Merging of byte-identical images, fonts, ICC profiles and form XObjects, removal of unreachable objects and Flate compression of raw streams at every level.
  • Optional removal of XMP metadata, page thumbnails and PieceInfo editor data, keeping the title and author.
  • Soft masks kept on transparent images; text, links, bookmarks and form fields come through intact.

Where the bytes in a PDF go

An image's size on paper is set by the matrix a page draws it with, so the tool walks every content stream, following form XObjects up to 12 levels deep, keeps the largest size at which each image is drawn and divides pixels by inches. A 4032 × 3024 phone photo printed 4 × 3 inches is a 1008 DPI image; Recommended makes it 600 × 450 pixels and Strong 384 × 288. For a picture stretched unevenly, the direction with fewer pixels per inch sets the scale: a 1200 × 1200 image drawn 4 inches wide and 2 tall becomes 600 × 600, which is 150 DPI across and 300 down. Nothing is enlarged; an image already at or under the target is only re-encoded at the level's quality. One that no page content draws, such as a picture inside a stamp annotation, is capped at 2000 pixels on its longest side, or 1400 at Strong. Either way, the new JPEG is used only if it is at least 10% smaller.

Re-encoding covers 8-bit RGB and greyscale images, ICC-tagged ones included, stored as JPEG or Flate data, with at least 2 KB of data and at most 40 megapixels. CMYK, palette (Indexed) and JPEG 2000 images stay byte for byte as they were, and, at Recommended and Strong, a warning reports how many. Also untouched, without being counted: mask streams, images with a colour-key mask, images whose soft mask carries /Matte, images with a Decode array, and CCITT or JBIG2 black-and-white scans. An image with ordinary transparency is re-encoded and keeps its soft mask as it was, since PDF lets a soft mask differ in resolution from its image unless it has /Matte. The replacement is always an RGB JPEG without an ICC tag: invisible for sRGB photos, slightly duller for one tagged Adobe RGB or Display P3.

The lossless steps run at every level. Byte-identical streams with matching dictionaries (images, font programs, ICC profiles, form XObjects) are merged, then identical font descriptors and font dictionaries, for up to four rounds, because one merge can make the objects pointing at it identical too; every reference is rewritten to the survivor. Objects unreachable from the catalog or the information dictionary are deleted, raw streams over 512 bytes are Flate-compressed, and the result is written out using object streams. The checkbox also removes the catalog's XMP packet and the /Thumb thumbnails and /PieceInfo editor data on the catalog, pages and form XObjects; the information dictionary, with the title and author, stays.

How it works

Once the file has passed the 50 MB and %PDF header checks, @cantoo/pdf-lib, the pdf-lib fork that can open encrypted documents, parses it with an empty password. That is enough for a "secured" PDF whose only protection is a ban on printing or copying; a document locked with an open password ends the run with the message about Unlock PDF. Metadata goes first if the box is ticked; duplicates are merged and unreachable objects deleted before any image is touched, so each distinct picture is encoded once and orphans never. A tokenizer then reads every content stream, tracking q, Q and cm, and notes the matrix at each Do that draws an image.

Eligible images are decoded with createImageBitmap, JPEG data without its EXIF block (so a camera's rotation flag cannot turn the picture) and without colour conversion, as PDF viewers ignore a JPEG's own profile; Flate data is inflated and its PNG row filters undone. Each picture is painted on a canvas of the target size with high-quality smoothing and encoded as a JPEG, and a result that saves 10% takes over the old object number with its /SMask, /Mask, /OC, /Intent, /StructParent and /Name entries, so every page drawing the image gets the new version. A second sweep drops objects left unused, such as an ICC profile no image needs any more, before the saved file faces the 2% and page-count checks.

Common use cases

  • An estate agent's 30-page brochure, exported with every photo at camera resolution, is cut to a size buyers can open over a phone connection.
  • A job applicant's 600 DPI colour scans of certificates must get under a careers portal's 5 MB limit; Recommended keeps a sixteenth of their pixels.
  • A teacher shares a colour worksheet pack scanned at 300 DPI on a learning platform with a 10 MB cap; pupils read it on screen, so Strong is enough.
  • A designer's proof saved from Illustrator with editing capabilities preserved goes to the client after a Light run with the checkbox ticked, which drops the second copy of the artwork without changing a pixel.
  • A charity merges twelve monthly newsletters built from one template with Merge PDF, then runs Light so the masthead image repeated in every issue is stored once.

How to use this tool

  1. Choose the PDF. It is compressed at once with Compression on Recommended: images at 150 DPI and Remove XMP metadata, page thumbnails and editor data ticked; a photo-heavy file shows a counter such as Compressing image 7 of 18.
  2. Read the chips: size before and after, percentage saved, images recompressed, duplicate objects merged. A CMYK, palette or JPEG 2000 warning explains a small saving.
  3. Still too large? Choose Strong: images at 96 DPI, smallest file. Must no pixel change? Choose Light: lossless clean-up only. Each run works on the original file again, never on the last result.
  4. Save the result with Download .pdf, then zoom into the most detailed photo and the smallest print before sending it on.

Example

Settings for a 14-page inspection report (inspection-report.pdf, 41.9 MB)

Compression: Recommended: images at 150 DPI
Remove XMP metadata, page thumbnails and editor data: on

Inside the file: 18 phone photos of 4032 × 3024 pixels,
each printed 4 × 3 in; a 1.6 KB logo stored again on every page

Result

inspection-report-compressed.pdf
14 pages in · 14 pages out · 41.9 MB → 1.2 MB · 97% smaller
18 images recompressed · 13 duplicate objects merged
Photos: 4032 × 3024 (1008 DPI as printed) → 600 × 450 JPEG, quality 0.75
Logo:   14 copies merged into one object; under 2 KB, so not re-encoded
Text:   unchanged, still selectable and searchable
Strong on the same file: photos at 384 × 288, quality 0.55

Tips for best results

  • Start with Recommended, then open the download at 100% zoom on its most detailed photo. 150 DPI holds up on screens and office printers; Strong's 96 DPI is for files read only on screen.
  • For screenshots, diagrams or line drawings stored as images, compare Light with Recommended: JPEG leaves faint smudges around hard edges and small lettering.
  • If Recommended changes nothing and the file has no photos or scans, Strong will not either: the two levels differ only in how images are re-encoded.
  • If the warning names CMYK, palette or JPEG 2000 images, re-export from the layout program with colours converted to sRGB to give the tool images it can shrink.
  • Untick the metadata box for a PDF you will reopen in Illustrator to edit; the editor data is what Illustrator rebuilds its document from.

Common pitfalls

Text and vector drawings are not made smaller: page content is only Flate-compressed if it was stored raw, so a text report, a CAD drawing or a deck of vector charts barely shrinks.

JPEG re-encoding is lossy. At Strong (96 DPI, quality 0.55) small print in scans, thin lines and fine textures soften, and the lost detail cannot be recovered from the copy.

Fonts cannot be shrunk. A fully embedded Chinese or Japanese font of several megabytes stays as it is; only byte-identical copies are merged.

Pages are not converted to images. The text layer survives intact, but heavy vector artwork cannot be traded for a lighter picture of itself.

CCITT and JBIG2 black-and-white scans, and the CMYK photos in print-ready files, are left alone, so such files shrink little.

Rewriting the file invalidates a certificate-based digital signature; compress before signing, never after.

Common errors and how to fix them

This PDF is already as compact as these settings allow, so your original file is returned unchanged.
Nothing saved 2%: the file is mostly text, vector art and fonts, or its images are already at or below the target or in formats the tool skips. The same sentence follows a compressed copy that failed to reopen correctly or a file too damaged to process.
Lossless clean-up found nothing more to remove. Choose Recommended or Strong to shrink the images inside this PDF.
Light's lossless clean-up saved less than 2%, but the file holds images that the other two levels can re-encode. Switch the level and the run repeats on the original.
4 images were left as they were because they are stored in a colour format this tool does not re-encode (CMYK, palette or JPEG 2000).
Only those images are skipped; everything else is compressed as usual. CMYK usually comes from press-ready exports, palette images from 256-colour graphics such as GIFs, and JPEG 2000 from some scanning software; a re-export in sRGB gives the tool images it can shrink.
This PDF is password-protected. Open it with Unlock PDF first, then try again.
The optimiser rewrites the file's objects, merging duplicates and re-encoding images, so it must read them first, and an encrypted file cannot be read. Remove the password in Unlock PDF, compress the plain copy, and add a password to the smaller file with Protect PDF if it must travel protected.
This file is larger than 50MB. Split it first or use a smaller file.
The limit applies to the file as chosen, before any compression. Cut it into parts with Split PDF, compress each part, and rejoin them with Merge PDF.

Best practices

  • Keep the full-resolution original for printing and editing; compression discards pixels for good.
  • Compress the finished document, after merging, numbering and watermarking, and before any certificate-based digital signature is applied.
  • Match the level to the destination: Recommended for anything that may be printed, Strong for screen-only files, Light where an image must stay exactly as captured, such as evidence photos.

Why one PDF loses 95% and another 2%

The saving depends on what the file is made of. Photos placed at a fraction of their camera resolution give the largest gains: a 4032 × 3024 picture printed 4 inches wide keeps 600 × 450 pixels at Recommended, about 2% of the original count, so reports built from phone photos often lose more than 90%. A 300 DPI colour scan of a Letter page, 2550 × 3300 pixels, keeps a quarter of them at Recommended (1275 × 1650) and about a tenth at Strong (816 × 1056).

A contract saved as PDF from Word or Google Docs is text and subset fonts, already Flate-compressed, so the original usually comes back. Black-and-white office scans are typically CCITT Group 4 or JBIG2, 1-bit formats far smaller than any JPEG of the page. Press-ready exports keep photos in CMYK, which is skipped and counted in the warning, and complete embedded fonts, common in documents set in Chinese, Japanese or Korean, can add megabytes that no setting reduces.

What the metadata checkbox removes, and what stays

The XMP packet is an XML copy of the metadata attached to the catalog, often naming the producing application and, in files from Adobe software, holding an edit history. Page thumbnails are previews some older tools embedded for every page. Editor data (/PieceInfo) is what applications keep for themselves: Illustrator stores a complete copy of its document there when Preserve Illustrator Editing Capabilities is ticked, which can double a PDF's size, and without it Illustrator reopens the file as an ordinary PDF.

The document's title and author, with its subject and keywords, stay; the producer field is replaced and the modification date updated. Re-encoded photos lose any camera EXIF block, GPS coordinates included, because the canvas writes a fresh JPEG, while untouched images keep theirs. Do not compress a PDF/A archive copy that must stay conformant: the XMP packet is where it declares itself, and the rewrite uses object streams, which PDF/A-1 forbids.

Frequently asked questions

Does compressing turn the pages into images?

No. Pages are never rasterised, so the text stays selectable and searchable, and links, bookmarks and form fields come through intact. The flip side: text and vector drawings are not made smaller and fonts are not subset or re-encoded, so a text PDF, a CAD plan or a page of vector charts barely shrinks.

How much quality does Strong cost?

Strong keeps 96 pixels per printed inch at JPEG quality 0.55. On an ordinary monitor at 100% zoom that is near the screen's own resolution; zoomed in, on a high-density display or on paper, fine detail softens and smooth areas such as sky can show blocky artefacts. Use Recommended for anything that may be printed.

Can I run the compressed file through again to make it smaller still?

At the same level every photo is already at its target, so each is only re-encoded at the same quality and seldom saves the 10% needed; the file usually comes back unchanged. Strong on a Recommended copy does shrink it but adds a second round of JPEG artefacts, so run Strong on the original instead.

Can I compress a password-protected PDF?

Only once it is unlocked; the password has to come off in Unlock PDF first. Print and copy restrictions without a password are a different matter: such a file is compressed, and the smaller copy is saved without the restrictions, as a warning notes, while an original that comes back unchanged keeps them.