Reduce PDF size without losing quality
By Felix Stiffel · · 6 min read
Find out what makes the file large
Before you compress anything, it helps to know where the bytes are. In most large PDFs the answer is images: photos from a phone, scanned pages, or screenshots pasted into a report. Text, fonts and the page structure are usually small by comparison.
Our test files show how uneven this is. A 20-page report written in a word processor and exported to PDF, with two embedded fonts and no images, was 49,923 bytes, about 49 KB. A four-page PDF made of four photos, each 4,000 × 3,000 pixels and saved as JPEG at quality 92 (a typical phone setting), was 11,864,882 bytes, about 11.9 MB. The four photos alone took 2.9 to 3.0 MB each. A three-page grayscale scan at 300 dpi came to 6.9 MB.
So the question is rarely how to shrink the PDF. It is how to shrink the images inside it without making them look worse where it matters.
What a compressor can and cannot change
A PDF compressor can do two things. It can tidy up the file structure: drop objects that no page uses any more and pack the rest more tightly. And it can re-encode images: save each photo again as a JPEG with a lower quality setting, and optionally scale it down to fewer pixels.
The first part never changes what you see, but it rarely saves much. The second part is where large savings come from, and it is also the only part that can cost quality. Text stays text: compression does not turn letters into pixels, so text remains sharp and searchable at every level.
Our Compress PDF tool works this way. Every level rebuilds the document to remove unused objects. Then each embedded JPEG is re-encoded with the settings of the level you chose. Extreme saves photos at JPEG quality 0.3 and scales the longest edge down to 1,024 pixels. Recommended uses quality 0.6 and a maximum of 2,048 pixels. Less Compression uses quality 0.85 and keeps the original resolution. An image is only replaced if the new version is smaller than the old one.
Some images are left untouched on purpose: CMYK images, images with transparency masks and images that are not stored as JPEG. Changing them safely would need more than a browser canvas can do, so the tool keeps the original rather than risk a wrong colour or a missing background.
The test: three files, three levels
We ran each test file through Compress PDF at all three levels in Chromium on a Linux machine and measured the size of the result. To see how much each image changed, we rendered page 1 of the original and of the compressed file at 72 and 150 dpi and compared the pixels. The comparison is given as PSNR in decibels: the higher the number, the closer the page looks to the original. It is a rough measure, not a verdict, but it ranks the levels consistently.
Photo PDF, 11.9 MB: Extreme produced 44 KB, with the photos scaled to 1,024 × 768 pixels (PSNR 37.2 dB at 150 dpi). Recommended produced 273 KB at 2,048 × 1,536 pixels (39.2 dB). Less Compression produced 8.5 MB at the full 4,000 × 3,000 pixels (44.1 dB). Each run took between 0.8 and 1.7 seconds.
Scanned PDF, 6.9 MB: Extreme produced 247 KB, Recommended 802 KB and Less Compression 5.8 MB. Here the difference between the levels was much bigger. The scanned pages shrank to an effective 88 pixels per inch at Extreme and 175 at Recommended, and the PSNR at 150 dpi fell from 47.4 dB (Less) to 24.6 dB (Recommended) and 19.8 dB (Extreme).
Text report, 49 KB: every level produced the same result, 29 KB, about 41 percent smaller. The report has no images, so the saving came from rebuilding the file. Part of what was dropped is worth keeping, though: the original had 10 bookmarks and accessibility tags, and the compressed file had neither.
One caveat: our test photos are synthetic, generated with smooth gradients and fine noise so that we could share them. Real photos with lots of detail, such as foliage or fabric, keep more bytes after compression, so expect smaller savings than the 97 to 99 percent we measured for Recommended and Extreme on photos.
Which level to pick
For photos that people will look at on a screen, Recommended is a good default. On our test file it kept 2,048 pixels on the long edge, more than the 1,920 pixels of a Full HD screen, and cut the file from 11.9 MB to 273 KB.
For scans of text, be more careful. A scanned page is one big image of your letters, so scaling it down blurs small print, footnotes and signatures. In our test, Recommended reduced the scan to 175 pixels per inch and Extreme to 88. Try Less Compression first. If the file is still too large, try Recommended and zoom in on the smallest text before you send it.
For documents created on a computer, such as an exported report or an invoice from accounting software, the level hardly matters. Our text report came out at the same size at all three levels. If such a file is still too large, it probably contains a few large images, a logo saved at print resolution for example, and those are worth fixing at the source.
Extreme is for cases where size beats everything: an upload form with a hard limit, or a preview you will replace with the full file later.
Mistakes that cost quality or time
Compressing the same file again does not help. We ran the Recommended result through Recommended a second time: the file changed by 14 bytes and the pages looked exactly as after the first pass, because the tool keeps an image only when the new version is smaller. Other tools may re-encode every time, and each JPEG pass loses a little more detail, so always start from the original.
Bookmarks and accessibility tags can get lost. Our compressor rebuilds the document page by page, and in our test the 10 bookmarks and the tag structure that screen readers use did not survive, nor did the PDF/A marking of an archive file. If you need those, compress only the image-heavy files where the savings are large, and keep the original of anything that must stay accessible or archivable.
Keep the original until you have checked the result. Open the compressed file, zoom to 100 percent on the page with the smallest text or the most important photo, and only then delete or replace the original.
Grayscale scans become colour images. The browser's JPEG encoder always writes three colour channels, so a grayscale scan is stored as an RGB image after re-encoding. It still looks the same, and in our test the file was much smaller anyway, but if you need a strictly grayscale file for an archive or a print shop, use Less Compression or leave the scan as it is.
Other ways to make a PDF smaller
The cheapest byte is the one you do not send. If only some pages are needed, remove the others or split the document and send only the part that matters. That keeps the remaining pages at full quality.
Fix the source when you can. Scanning text at 200 to 300 dpi in grayscale instead of colour, or resizing photos before you insert them into a document, gives a smaller PDF from the start and avoids a second round of compression.
Finally, compression in the browser means your file is never uploaded: the images are re-encoded by your own browser, and the result is saved straight from memory to your device.