Skip to content

Stop shipping "too large" PDFs

Compress PDF API

Your PDFs are perfect—until they hit a 25MB email cap, take forever to load, or get rejected by upload forms. Compress them without breaking readability using a quality-first workflow you can automate end‑to‑end. Start with our PDF API and plug compression into any app in minutes.

No credit card required to start
Typical savings: 40–85% smaller files
Join 18,400+ teams automating PDFs

Compression outcome preview

Pick a mode. See what changes.

1 API call

proposal.pdf

Original: 26.3 MB

Mode

Balanced

Lossless

-18%

Keep all pixels

Balanced

-62%

Great for sharing

Aggressive

-82%

For strict limits

Output

Compressed: 10.0 MB

Readable?

Yes (prints clean)

The trick isn't "compress harder." It's choosing the right mode for the job—and making it repeatable.
412M+
PDFs processed reliably
47 min/day
Average time saved per team
99.95%
Uptime across last 90 days
1–3s
Typical compression time

You know the feeling when a PDF is "done"… and still unusable

The design looks perfect. The export is clean. Then the real world hits: email gateways, upload limits, slow mobile connections, and customers who simply… don't wait.

The "why is this taking so long?" moment

Heavy PDFs delay page loads, previews, and downloads. Every extra second quietly drains conversions.

Mobile users don't forgive big files

A 30MB brochure is a bounce on cellular. Compression is not "nice to have"—it's accessibility.

The hidden cost: "quick fixes" that ruin quality

Random tools strip metadata, blur text, or mangle embedded images—then you re-export and lose hours.

The #1 mistake teams make with PDF optimization

They treat compression like a single slider. But the real trade-off is a decision: What can change (images, downsampling, recompression) and what must not (text sharpness, print fidelity, links, structure). Get that wrong and you pay twice—once in failed delivery, again in rework.

There's a better way: choose a compression goal, not a gamble

A solid compress PDF API should make compression predictable: you pick the outcome (quality-first, balanced, or aggressive), and the API applies the best mix of techniques for that goal.

Quality vs Size: the real trade-off

Smaller files usually come from changing image data: downsampling, recompressing, removing redundant resources, or optimizing embedded content. The more you chase size, the more you risk artifacts—especially in scans, screenshots, and photo-heavy pages.

Quality-first

Best for contracts, manuals, print

Balanced

Best for sharing & web viewing

Aggressive

Best for strict upload limits

Lossless vs Lossy: what changes (and what doesn't)

Lossless compression preserves the original visual data—think cleanup, deduplication, and smarter encoding. It's safer, but size savings are smaller. Lossy compression reduces file size by discarding some image detail (often unnoticeable at normal zoom), delivering much larger savings—but it must be applied intentionally.

Lossless is ideal when:

  • • Text must stay razor sharp (legal, technical docs)
  • • You plan to re-edit the PDF later
  • • Print quality is non-negotiable

Lossy is ideal when:

  • • PDFs are primarily viewed on screens
  • • The PDF is image-heavy (scans, photos)
  • • You're fighting strict delivery limits

If your bottleneck is sending PDFs through email, read our guide on Email Limits to choose the right target size (and avoid "message rejected" surprises).

Explore features

Fast integration

Compress in one request. Choose a mode.

cURL
curl -X POST "https://api.xspdf.com/v1/pdf/compress" \
  -H "Authorization: Bearer $API_KEY" \
  -F "file=@proposal.pdf" \
  -F "mode=balanced" \
  -F "target_mb=10" \
  -o proposal.compressed.pdf

Mode-aware compression: lossless, balanced, aggressive.

Predictable outputs: set a target size to avoid trial-and-error.

Safe defaults: prioritize readability; don't destroy text edges.

Also known as:

If you're searching for a shrink PDF API or a reduce PDF size API, you're in the right place. The difference is control—compression that matches your use case instead of "one-size-fits-none."

Compression that behaves like a product—not a lottery

You're not trying to "make it smaller." You're trying to pass limits, keep quality, and ship on time. These are the outcomes that matter.

Hit size targets consistently

Set a target MB and let the API optimize toward it—no more "compress, check, repeat."

Preserve usability (links, text, structure)

Compression shouldn't "flatten" your document. Keep clickable links, selectable text, and clean navigation.

Choose the right mode automatically

Scans, vector-heavy docs, and photo PDFs compress differently. Use intelligent mode selection to avoid quality cliffs.

Safe for workflows at scale

Compress thousands of PDFs per day without manual intervention—perfect for invoices, statements, and portals.

Lower storage & bandwidth costs

Don't let oversized PDFs inflate hosting bills. Smaller files reduce transfer costs and speed up downloads.

Old way vs new way (the part nobody talks about)

Old way: manual + unpredictable

  1. Export PDF from your tool
  2. Upload to a random compressor
  3. Download and inspect every page
  4. Repeat when it looks blurry
  5. Find out the hard way it still fails email/upload limits

New way: API + controlled outcomes

  1. Send PDF to the API
  2. Select lossless/balanced/aggressive (or auto)
  3. Optionally set a target size (MB)
  4. Receive an optimized PDF that still looks professional
  5. Ship it confidently—every time

FAQ: Compress PDF API (what teams ask before they commit)

These aren't theoretical questions. They're the "will this break my PDFs?" concerns that stop projects from shipping.

How much quality will I lose with "balanced" mode?

Balanced mode targets typical screen viewing and printing. Text stays sharp, vector graphics remain clean, and photos compress just enough to save significant size without visible artifacts at normal zoom levels. You'll typically see 40-70% file size reduction.

Can I set a specific target file size (e.g., "must be under 10MB")?

Yes. Use the target_mb parameter to specify your size goal. The API will optimize toward that target while preserving as much quality as possible within the selected mode.

Does compression remove metadata, form fields, or links?

No. The API preserves document structure, interactive elements, hyperlinks, and metadata by default. Compression focuses on optimizing visual content (images, embedded resources) without flattening functional elements.