How to Compress a PDF Offline in Your Browser
Published April 11, 2026 ยท 9 min read ยท By the GoPDFConverter team
Ten years ago, "compress a PDF" meant either installing Acrobat Pro or uploading to a remote service. Neither option was great. Today, modern browsers can run the same compression engines used by those desktop tools, entirely on your device, and store the whole app for offline use via a Service Worker. This guide explains how offline browser-based compression actually works, which image codecs you should care about, and how to hit target file sizes without losing legibility.
What "offline compression" really means
There are three things people commonly mean when they say "offline PDF compressor":
- A desktop application installed on your computer (Adobe Acrobat, PDF Studio, Foxit). These are genuinely offline but require installation, a paid license, and OS-specific binaries.
- A browser-based tool that runs entirely in the browser and processes files with JavaScript and WebAssembly. The code is loaded from the web, but the files themselves never leave your device. After the first visit, many of these tools cache their own assets in a Service Worker so they work even without an internet connection.
- A command-line utility like
ghostscript,qpdf, orpdftk. These are powerful but opaque to non-developers.
This guide focuses on option 2: browser-based PDF compression that runs locally. It is the most accessible of the three, carries none of the privacy costs of "upload to compress" tools, and on modern hardware it finishes compressing a typical 50 MB image-heavy PDF in under 10 seconds.
Why PDFs get large in the first place
Before compressing, it helps to know what you are compressing. A PDF file is basically a container for three kinds of content:
- Text streams: the characters on each page plus their font and positioning. Text is already compact; text-only PDFs rarely exceed a few hundred KB per 100 pages.
- Embedded fonts: the subset of each typeface that the document actually uses. A well-built PDF subsets its fonts; a poorly built one embeds the entire font family multiple times.
- Images: scanned pages, screenshots, photos, diagrams. These dominate PDF size in practice. A single uncompressed 300 DPI scan of a Letter-size page is about 25 MB on its own. A 10-page scanned document can easily push 100 MB before any compression.
That is why every serious PDF compressor starts with image compression. If you can shrink the images without making them unreadable, you can often trim 40 to 70 percent off an image-heavy PDF in one pass.
The image codecs that matter
Two open-source image compressors punch well above their weight in the browser:
MozJPEG
MozJPEG is a fork of the reference libjpeg library, tuned for smaller files at the same visual quality. It is maintained by Mozilla, runs in WebAssembly at near-native speed, and produces JPEGs that are typically 5 to 15 percent smaller than libjpeg at equivalent quality. For photographic content in a scanned PDF, MozJPEG is usually the right tool.
OxiPNG
OxiPNG is a Rust reimplementation of optipng focused on aggressive lossless PNG compression. It rewrites the PNG structure to use the most efficient filter, deflate level, and chunk layout. For graphics, diagrams, charts, and anything with sharp edges, OxiPNG beats lossy JPEG in both size and quality.
GoPDFConverter uses both. During compression, it analyzes each embedded image, decides whether MozJPEG or OxiPNG is the better codec for that image, re-encodes it at the selected quality level, and writes the new image back into the PDF stream. Non-image content (text, fonts, vector graphics) passes through untouched.
Step-by-step: compressing a PDF offline
- Open the Compress PDF tool. Visit gopdfconverter.com/tools/compress/ from any modern browser. The tool loads its WebAssembly engines from a CDN on first visit, then caches them via a Service Worker.
- Drop your PDF onto the page. The File API reads the file into memory as an ArrayBuffer. No network request goes out.
- Let the analyzer run. GoPDFConverter scans every embedded image and reports its format, dimensions, and estimated savings under each preset.
- Pick a preset. Light preserves near-original image quality with minimal size reduction. Balanced is the right default for most documents. Maximum recompresses more aggressively for the smallest file.
- Click Compress. MozJPEG and OxiPNG run on your CPU, each image gets its new encoding, and PDF-LIB rebuilds the document with the compressed streams.
- Download and verify. The smaller PDF lands in your Downloads folder. Open it and confirm text is still sharp and images are still readable. If not, re-run with Light.
Hitting target file sizes
Some platforms force a specific cap: 10 MB for email, 5 MB for an insurance portal, 2 MB for a job application system. Here is how to hit those targets without guesswork:
- Under 10 MB target: Balanced preset is usually enough for scanned documents up to 50 MB. Run it once, check the result.
- Under 5 MB target: Start with Maximum. If the result is still over, split out pages that are text-only (they compress very little anyway) into a separate file, compress the image-heavy pages aggressively, and merge them back.
- Under 2 MB target: This is aggressive. Expect some visible quality loss. Consider whether the platform actually needs every page or just a cover sheet plus a summary.
- Under 1 MB target: At this point, ask whether a PDF is even the right format. A compressed image in a ZIP is often smaller and more usable.
When offline compression is not the right choice
Offline browser-based compression is the right default for privacy-sensitive documents, mobile use, and anywhere you need quick results without installing software. It is NOT the right choice for:
- Thousands of files at once. Browser tabs run single-threaded. A batch process on the command line using
ghostscriptorqpdfwill be faster and parallelizable. - Very large files (1 GB+). Browser memory tops out on most devices around 2 GB per tab. Big archival scans are better handled by a desktop tool with streaming IO.
- Specialized workflows like PDF/A conversion. These need specific compliance features that browser libraries do not yet implement.
For the 95% of cases in between, offline browser-based compression is the right default.
Frequently asked questions
Can I compress a PDF offline?
How much can a PDF be compressed without uploading it?
Is offline compression as good as server-side?
How do I hit a specific target file size?
Will compression break OCR text or digital signatures?
Try it yourself
The fastest way to experience offline browser-based compression is to run one. Open GoPDFConverter Compress PDF, drop a file on the page, and time it. For most real-world documents, the whole process finishes in under 10 seconds, completely offline after the first load.