Compress images
- Runs in your browser
- No signup
- Formula shown below
- Reviewed
Compressing an image reduces its file size by discarding detail the eye is least sensitive to. JPEG quality 75 typically removes 60 to 80% of a photograph's bytes with no visible difference at normal viewing distance. This tool can also hit an exact target size by binary-searching the quality factor across seven encodes.
How to compress an image
- 01
Add your images
Drag one or many images onto the drop zone. JPG, PNG, WebP, GIF and BMP are accepted, and a whole batch is processed in one pass.
- 02
Set a quality level
Move the quality slider. Around 75% is the usual sweet spot where most of the file size goes and the difference stays invisible.
- 03
Or set a target size
Enter a target in kilobytes and the encoder will binary-search the quality factor to land just underneath it.
- 04
Compress and compare
Press Process and check the before-and-after size and the percentage saved for every image in the list.
- 05
Download the results
Download images individually or all at once. Nothing was uploaded, so closing the tab discards everything.
The formula
find the largest quality q between 0.30 and 0.95 for which size(q) fits within target
- q
- The JPEG or WebP quality factor, from 0.30 at the low end to 0.95 at the high end.
- size(q)
- The encoded file size in bytes at quality q, which increases monotonically with q.
- target
- The requested maximum file size in bytes.
- binary search
- Halving the quality interval seven times, which locates q to within 0.5% using 7 encodes instead of up to 65.
Because encoded size rises monotonically with quality, binary search is valid and finds the highest quality that still fits the target. A linear walk down the quality scale would need many more encodes, and each encode of a 12-megapixel photograph costs real time on a phone.
Worked example
- Source
- photo.jpg — 4032 × 3024 pixels, 5.2 MB
- Quality
- 75%
- Target size
- not set
- Result
- about 890 kB — an 83% reduction
The image keeps its 4032 × 3024 dimensions, so all 12.2 megapixels remain. Re-encoding at quality 75 discards high-frequency detail within each 8 × 8 block that the eye barely registers, taking the file from 5.2 MB to roughly 890 kB. That is a saving of 4.3 MB, or 83%, with no change in resolution. Setting a 500 kB target instead would make the encoder binary-search quality and settle near 0.55.
Frequently asked questions
What is the best quality setting for JPEG compression?
Quality 75 to 80 is the standard recommendation for photographs and is where most of the size saving happens. Below 60, blocking artefacts start appearing in smooth gradients such as skies. Above 90 the file grows sharply for detail almost nobody can see — moving from 80 to 95 can double the file size for a barely perceptible gain.
How do you compress an image to an exact file size?
Enter a target in kilobytes and the tool encodes repeatedly, halving the quality interval each time, until it finds the highest quality that still fits. Seven encodes locate the quality factor to within about 0.5%. This is how you meet a hard limit such as a 200 kB upload cap or a 2 MB email attachment ceiling.
Is image compression lossy or lossless?
JPEG and WebP quality settings are lossy: discarded detail is gone permanently, and re-compressing an already-compressed image degrades it further. PNG is lossless, so its size is reduced only by simplifying the palette rather than by any quality factor. Always keep the original file, because compression cannot be undone.
Why did compressing my PNG barely help?
PNG uses lossless DEFLATE compression, which has no quality dial to turn down. A photograph stored as PNG is enormous because lossless coding cannot exploit the eye's insensitivity to fine detail. Converting a photographic PNG to JPEG or WebP typically cuts it by 80 to 95%; keep PNG only for logos, screenshots and images needing transparency.
Does compression change image dimensions?
No. Compression keeps every pixel and reduces how many bytes each one costs. Resizing is the separate operation that changes pixel dimensions. Combining both gives the largest savings: a 4000-pixel photograph resized to 1600 pixels and then compressed at quality 75 is routinely 95% smaller than the original.
How much can compression improve page load speed?
Images are usually the largest asset class on a web page, so the effect is direct. Cutting 5 MB of photographs to 900 kB removes about 4 MB from the download, roughly 4 seconds on a 8 Mbps mobile connection. Because images frequently form the Largest Contentful Paint element, that saving lands squarely on a Core Web Vital.
Are images uploaded to compress them?
No. Each file is decoded and re-encoded by the browser's own image codecs inside this page. Nothing is transmitted, and this site has no server-side code that could receive a file. That makes the tool safe for photographs of documents, identification and anything else you would not paste into a website.
Sources
- JPEG (ISO/IEC 10918) — image compression standard — Joint Photographic Experts Group
- WebP compression techniques and comparison — Google
- Optimize images to improve Largest Contentful Paint — Google web.dev
Last reviewed: · Formula and sources verified by Syed Aqeel Ahmad Gillani. See the methodology for how every calculation is derived.