Image Compressor
Compress an image to reduce file size while maintaining visual quality
/v1/image/compress
curl "https://image.toolkitapi.io/v1/image/compress?url=https://toolkitapi.io/static/samples/sample-image.png&quality=75&format=jpeg"
import httpx
resp = httpx.get(
"https://image.toolkitapi.io/v1/image/compress?url=https://toolkitapi.io/static/samples/sample-image.png&quality=75&format=jpeg",
)
print(resp.json())
const resp = await fetch("https://image.toolkitapi.io/v1/image/compress?url=https://toolkitapi.io/static/samples/sample-image.png&quality=75&format=jpeg", {
});
const data = await resp.json();
console.log(data);
# See curl example
{
"image": "/9j/4AAQSkZJRgABAQ...(base64 data)...",
"format": "jpeg",
"quality": 75,
"compressed_size_bytes": 524288
}
Try It Live
Description
How to Use
1. Provide the source image via the `url` query parameter.
2. Set the `quality` parameter — 75 is a good default for JPEG, 80 for WebP.
3. Choose `format` (jpeg for photos, webp for modern browsers, png for lossless).
About This Tool
Use the Image Compressor to reduce file size for faster web delivery, email attachments, and storage optimization. Control the quality parameter from 1 (maximum compression) to 100 (lossless for PNG) to balance size and visual fidelity.
The endpoint reports the compressed file size, so you can verify the savings. JPEG and WebP formats offer the best compression ratios; PNG compression is lossless.
Why Use This Tool
- Web performance — Compress images for faster page loads and better Core Web Vitals
- Email attachments — Reduce image sizes to fit email size limits
- Storage optimization — Bulk-compress image libraries to save storage costs
- CDN bandwidth — Lower bandwidth costs by serving smaller image files
- Mobile optimization — Deliver lighter images for mobile users on slow connections
Frequently Asked Questions
What quality setting should I use?
Why is my reduction percentage negative?
Does compression change the image dimensions?
Start using Image Compressor now
Get your free API key and make your first request in under a minute.