PDF Compressor
Reduce PDF file size by removing duplicate objects and compressing streams
/v1/pdf/compress
curl -X POST "https://pdf.toolkitapi.io/v1/pdf/compress" \
-H "Content-Type: application/json" \
-d '{"url": "https://toolkitapi.io/large-report.pdf"}'
import httpx
resp = httpx.post(
"https://pdf.toolkitapi.io/v1/pdf/compress",
json={"url": "https://toolkitapi.io/large-report.pdf"},
)
print(resp.json())
const resp = await fetch("https://pdf.toolkitapi.io/v1/pdf/compress", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"url": "https://toolkitapi.io/large-report.pdf"}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"pdf": "JVBERi0xLjcKMSAwIG9iago8...",
"original_size": 5242880,
"compressed_size": 2097152,
"savings_percent": 60.0,
"page_count": 45
}
Description
How to Use
1. Provide the PDF via `pdf` (base64) or `url` (public URL).
2. The endpoint automatically applies compression — no configuration needed.
3. Check `savings_percent` in the response to see how much the file shrank.
4. Use the returned `pdf` (base64) as your optimized version.
About This Tool
PDF Compressor reduces the file size of PDF documents by removing duplicate internal objects, eliminating orphaned data, and compressing content streams. It's a lossless optimization — the visual content remains identical, but the file takes up less space.
Use this tool before distributing large PDFs via email, uploading to storage with size limits, or serving documents over bandwidth-constrained connections. The response includes both the original and compressed sizes along with the percentage savings.
Documents with redundant embedded objects, uncompressed streams, or bloated metadata benefit the most. Already-optimized PDFs may see minimal reduction.
Why Use This Tool
- Email attachments — Shrink PDFs to fit within email size limits
- Web delivery — Reduce download times for PDFs served from websites
- Storage optimization — Compress document archives to save disk space
- Upload compliance — Meet file size requirements for form submissions and portals
Frequently Asked Questions
Is the compression lossless?
Why is the savings percentage low for my file?
Does this reduce image quality?
Start using PDF Compressor now
Get your free API key and make your first request in under a minute.