Back to Blog

Compress PDF Files Easily with Ghostscript

Have you ever tried to share a PDF only to find it's way too large to send? Large PDFs are a common headache — but there's a simple, free solution: Ghostscript. With a single command, you can dramatically reduce PDF file size without spending a dime.


What is Ghostscript?

Ghostscript is an open-source interpreter for PostScript and PDF. It's a battle-tested tool used for PDF compression, conversion, and rendering. It's completely free and supports Windows, Mac, and Linux.


Installation

Download the installer from the official site and run it.

After installation, the executable will be at:

TEXT
C:\Program Files\gs\gs10.06.0\bin\gswin64c.exe

The Command

Bash
MSYS_NO_PATHCONV=1 "C:/Program Files/gs/gs10.06.0/bin/gswin64c.exe" \
  -sDEVICE=pdfwrite \
  -dCompatibilityLevel=1.4 \
  -dPDFSETTINGS=/ebook \
  -dNOPAUSE -dQUIET -dBATCH \
  -sOutputFile="output.pdf" "input.pdf"

Note for Git Bash on Windows: Bash automatically converts paths like /ebook into Windows absolute paths, which breaks the command. Prepend MSYS_NO_PATHCONV=1 to prevent this.


Quality Settings

Adjust -dPDFSETTINGS to balance compression and quality:

OptionResolutionBest For
/screen72 dpiScreen viewing, smallest file size
/ebook150 dpiGeneral documents, balanced quality
/printer300 dpiPrint-ready documents
/prepress300 dpi+Publishing, minimal compression

For most use cases, /ebook is the sweet spot.


Results

FileSize
Original724 MB
Compressed29 MB
Reduction96%

Wrapping Up

Ghostscript is easy to install and takes just one command to compress a PDF significantly. If quality matters, go with /printer. If size is the priority, try /screen. Either way, it's one of the most effective free tools out there for PDF optimization.

Comments