Shrink your PDF without losing what matters
Upload a PDF and cut its file size down — fast, free, and entirely in your browser. No account needed, no waiting for a server, no size limit imposed by a queue.
Large PDFs are a headache: email attachments bounce, upload fields reject them, and sharing a 40 MB scan feels embarrassing. This tool strips out redundant data and resamples embedded images so the file stays readable but takes up far less space.
How to compress a PDF — step by step
- Click "Choose file" (or drag your PDF onto the upload area above).
- Pick a compression level — light keeps quality high; heavy shrinks the file as much as possible.
- Click "Compress PDF" and wait a moment while your browser processes the file.
- Download the result. The new file name shows the reduced size so you can compare instantly.
Your PDF never leaves your device. It is processed entirely in your browser using JavaScript — unlike most online PDF tools, nothing is uploaded to a server.
Realistic example: compressing a scanned report
Say you have a 12-page scanned report saved as a PDF. Original size: 8.4 MB. After applying medium compression (image quality reduced to 72 dpi equivalents, duplicate font data removed), the output comes out at roughly 1.9 MB — a 77% reduction — while the text stays crisp and legible on screen and in print.
| Compression level | Typical size reduction | Best for |
|---|---|---|
| Light | 10–30% | Contracts, forms you'll sign again |
| Medium | 40–70% | Reports, presentations, portfolios |
| Heavy | 70–90% | Scanned documents, archival files |
How to compress a PDF in code
Sometimes you need to reduce PDF size in a script or a build pipeline rather than by hand. Here are two common approaches.
Python — using Ghostscript
Ghostscript is the most reliable open-source tool for PDF file-size reduction. Install it from ghostscript.com, then run:
import subprocess
def compress_pdf(input_path, output_path, quality='ebook'):
# quality options: screen | ebook | printer | prepress
subprocess.run([
'gs',
'-sDEVICE=pdfwrite',
'-dCompatibilityLevel=1.4',
f'-dPDFSETTINGS=/{quality}',
'-dNOPAUSE',
'-dBATCH',
f'-sOutputFile={output_path}',
input_path
], check=True)
compress_pdf('report.pdf', 'report_small.pdf', quality='ebook')
The ebook preset targets roughly 150 dpi — good enough for on-screen reading and email. Use screen for maximum shrinkage or printer when print quality must be preserved.
JavaScript (Node.js) — using pdf-lib
pdf-lib can rewrite and strip metadata from a PDF. For deeper image-level compression you would pair it with sharp or a canvas library, but for quick size reduction on pure-text PDFs this works well:
import { PDFDocument } from 'pdf-lib';
import fs from 'fs/promises';
async function stripMetadata(inputPath, outputPath) {
const existingBytes = await fs.readFile(inputPath);
const pdfDoc = await PDFDocument.load(existingBytes);
// Remove author, title, and other optional metadata
pdfDoc.setTitle('');
pdfDoc.setAuthor('');
pdfDoc.setSubject('');
pdfDoc.setKeywords([]);
pdfDoc.setProducer('');
pdfDoc.setCreator('');
const pdfBytes = await pdfDoc.save({ useObjectStreams: true });
await fs.writeFile(outputPath, pdfBytes);
}
stripMetadata('report.pdf', 'report_small.pdf');
The useObjectStreams: true flag tells pdf-lib to pack objects more tightly, which alone can trim 5–15% off many PDFs.
How it works under the hood
PDF files can grow large for a few reasons: high-resolution embedded images, duplicate font data, revision history left by editors like Word or Acrobat, and uncompressed object streams. Compression works by resampling images to a lower resolution, removing those revision snapshots, and re-encoding object streams with Deflate (the same algorithm ZIP uses).
This browser tool uses JavaScript libraries that read the PDF structure, apply those optimisations, and write a new, leaner file — all locally on your machine. The PDF specification (maintained by PDF Association) defines exactly how object streams and image compression work inside a PDF, if you want the full technical detail.
When to use this tool — and when to try something else
Use it when:
- A PDF is too large to email (most providers cap at 25 MB).
- You need to upload a document to a portal with a strict file-size limit.
- A scanned file is bloated because it was saved at 300 dpi when 96 dpi is plenty for screen use.
- You want to reduce storage costs on cloud drives without converting to a different format.
Consider a different approach when:
- The PDF contains vector artwork or fine-print legal text where any image resampling is unacceptable — use
printerorprepresssettings in Ghostscript instead. - You need to make heavy edits before compressing — edit first, then compress, so you don't lose quality twice.
- The file is already very small (under 100 KB) and most of its weight is actual text content — there is little left to remove.
- You need to reduce multiple PDFs at once on a schedule — a command-line script (see the Python example above) will be faster than uploading one at a time.
Once your file is the right size, you might also need to merge several PDFs into one or split out specific pages — both of which you can do with the same tool engine here on TechToolExpert.
If you work with structured data formats too, our JSON Beautifier and JSON Minifier - Compress & Minify JSON Online follow the same browser-only, no-upload approach for JSON files.
Bottom line: if your PDF is too big to send or upload, drop it above and download a smaller version in seconds — no sign-up, no upload, no waiting.