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":

  1. 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.
  2. 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.
  3. A command-line utility like ghostscript, qpdf, or pdftk. 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:

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

  1. 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.
  2. Drop your PDF onto the page. The File API reads the file into memory as an ArrayBuffer. No network request goes out.
  3. Let the analyzer run. GoPDFConverter scans every embedded image and reports its format, dimensions, and estimated savings under each preset.
  4. 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.
  5. 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.
  6. 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:

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:

For the 95% of cases in between, offline browser-based compression is the right default.

Frequently asked questions

Can I compress a PDF offline?
Yes. Modern browsers can run image-compression libraries (MozJPEG, OxiPNG) entirely on your CPU. GoPDFConverter uses these to shrink PDFs without uploading them to any server, and after the first visit the whole app is available offline via a Service Worker cache.
How much can a PDF be compressed without uploading it?
Image-heavy PDFs typically shrink 40-70% with balanced settings. Text-only PDFs see 5-15% reduction. Aggressive settings can go further at the cost of image quality.
Is offline compression as good as server-side?
For the same algorithms, yes. MozJPEG running in WebAssembly produces the same output as MozJPEG running on a server. On a modern laptop or phone, the offline version is often faster overall because it avoids the upload and download round-trip.
How do I hit a specific target file size?
Start with the Balanced preset, check the result, and iterate. If it is still too large, switch to Maximum. If quality suffers, try splitting the PDF and compressing only the image-heavy pages.
Will compression break OCR text or digital signatures?
OCR text layers are preserved as-is; compression only touches embedded images. Digital signatures usually break because any change to the PDF bytes invalidates the signature. If you need to keep a signature, compress before signing, not after.

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.