HomeGuidesHow to Compress PDF Files
Guide

How to Compress PDF Files

3 methods — Papiral, Ghostscript, and online tools

Large PDF files cause problems — email attachment limits, slow uploads, and bloated storage. Here are three ways to compress PDFs and reduce their file size.

Method 1: Using Papiral (fastest, free, no software)

The easiest way to compress one or many PDFs in your browser.

  1. 1Go to the Compress PDF tool on Papiral.
  2. 2Upload your PDF (or a ZIP of multiple PDFs).
  3. 3Click Process — Papiral re-serializes the PDF structure for smaller output.
  4. 4Download the compressed PDF or ZIP.

Papiral's compression is lossless — it doesn't touch embedded images, so quality is fully preserved.

Method 2: Ghostscript (command line, deeper compression)

Ghostscript can re-encode embedded images, achieving larger reductions for image-heavy PDFs.

  1. 1Install Ghostscript: brew install ghostscript (Mac) or apt install ghostscript (Linux).
  2. 2Run the compression command below.
  3. 3Find your compressed file at output.pdf.

bash

gs -sDEVICE=pdfwrite \
   -dCompatibilityLevel=1.4 \
   -dPDFSETTINGS=/ebook \
   -dNOPAUSE -dBATCH \
   -sOutputFile=output.pdf \
   input.pdf

Use /screen for maximum compression (lowest quality), /ebook for balanced, /printer for high quality.

Method 3: Python with pikepdf

  1. 1Install pikepdf: pip install pikepdf
  2. 2Use the script below to compress and save.

python

import pikepdf

with pikepdf.open("input.pdf") as pdf:
    pdf.save("output.pdf", compress_streams=True)

Frequently asked questions

How much can I expect to reduce a PDF's size?

It depends on the PDF content. Lossless structure compression (like Papiral uses) typically reduces size by 5–30% on complex documents. Ghostscript with image re-encoding can achieve much larger reductions for image-heavy PDFs, at the cost of some image quality.

Does PDF compression affect text readability?

Papiral's lossless compression never affects text. Ghostscript's image re-encoding may slightly reduce image quality at aggressive settings, but text is always preserved.

Ready to try the fastest method?

Reduce PDF file size by re-saving with optimized structure. No quality settings required — just smaller files.

Compress PDF — free