Image Compressor
Make an image file smaller as JPEG, WebP, AVIF or PNG, by quality or to fit a target size such as 200 KB, and see the real result: the compressed picture at 100%, its size, and the measured quality loss in dB.
How to Use
- Drop an image on the box, click to browse, or paste one. TIFF, PSD, HEIC, TGA and camera RAW files open too. A built-in sample is loaded so you can try the presets straight away.
- Pick a Format: JPEG works everywhere, WebP and AVIF are usually smaller, PNG keeps every pixel.
- Either set a Quality, or switch to Target size and type the largest file you can accept, for example 200 KB. Set a Longest side to shrink a big photo first.
- Check the result: the preview shows the compressed file itself, the 100% detail compares the same spot before and after, and PSNR measures the loss.
- Click Download to save exactly the file that was measured.
Worked Example
The built-in 640 × 420 sample as JPEG at quality 80. Uncompressed it is 640 × 420 × 3 = 806,400 bytes. The JPEG file is 28,943 bytes (28.3 KB): a ratio of 806,400 ÷ 28,943 = 27.9 : 1, or 28,943 × 8 ÷ 268,800 = 0.861 bits per pixel instead of 24. Decoded again, it differs from the original by MSE 22.87, so PSNR = 10 × log₁₀(65,025 ÷ 22.87) = 34.54 dB. These figures come from a Chromium-based browser (Chrome, Edge); other browsers ship other encoders, so their sizes differ a little.
The same picture as WebP 75, AVIF 50, or fitted into 20 KB. WebP at quality 75 gives 10,382 bytes and 34.62 dB, about the same measured loss in 36% of the JPEG’s size; AVIF at quality 50 gives 5,454 bytes and 35.54 dB. Asked to fit JPEG into 20 KB (20,480 bytes), the search tried 8 qualities and kept quality 69: 20,026 bytes at 33.53 dB.
The common mistake: saving a photo as PNG to “keep the quality”. PNG is lossless, PSNR ∞, but the sample takes 292,333 bytes, 10.1 times the size of the JPEG at quality 80, whose loss (34.54 dB) you can check yourself in the 100% detail view. PNG is the right choice for screenshots, logos and flat graphics, not for photos.
Show Work
Formulas
How Lossy Compression Saves Space
JPEG, standardised in 1992 as ITU-T T.81 (ISO/IEC 10918-1), splits the picture into 8 × 8 blocks, turns each block into frequencies with the discrete cosine transform, and rounds the fine-detail frequencies coarsely. The quality setting controls how coarse that rounding is, which is why low qualities show square blocks and ringing around sharp edges. Colour is usually stored at lower resolution than brightness, because the eye is less sensitive to it.
WebP, released by Google in 2010, codes its lossy images with the intra-frame coding of the VP8 video codec, and AVIF, published by the Alliance for Open Media in 2019, stores AV1 video-codec frames in a HEIF container. Both predict each block from its neighbours and code only the difference, which is why they are usually smaller than JPEG at the same look. None of them can be compressed again without loss, so always start from the best original you have.
About This Tool
This tool compresses an image as JPEG, WebP, AVIF or PNG, by quality or to fit a target size, optionally resizing it first. It then decodes the new file and compares it with the original: the preview, the 100% detail and PSNR all come from the file you will download, not from an estimate. Settings can be put in the page address, for example ?fmt=webp&q=70&max=1600. For other output formats, use the Universal Image Converter.
Images are decoded and encoded in your browser by the engine behind the Universal Image Converter, so TIFF, PSD, HEIC, TGA and RAW files can be compressed too. Nothing is uploaded.
Related tools: Image Resizer, Universal Image Converter, and Image Diff.
Frequently Asked Questions
Which format should I choose?
JPEG opens everywhere and is the safe choice for photos. WebP is supported by all current browsers and is usually smaller at the same look. AVIF is often smaller still but takes longer to encode, and some older software cannot open it. PNG is lossless: right for screenshots, logos and graphics with flat colour, and usually far larger for photos.
How does Target size work?
The picture is encoded repeatedly: a binary search over quality 1 to 100 finds the highest quality whose file still fits, which takes about seven or eight encodes. If even quality 1 is too big and “Shrink if needed” is ticked, the picture is scaled down and the search runs again. If the target still cannot be reached, the tool says so instead of handing you a file that is over the limit.
What does PSNR tell me?
The new file is decoded again and compared with the original pixel by pixel. PSNR = 10 × log₁₀(255² ÷ MSE), where MSE is the mean squared difference. Higher is closer: an MSE of 4 gives 42.11 dB and an MSE of 16 gives 36.09 dB, and every halving of the error adds about 3 dB. A lossless PNG gives ∞.
Why did my file get bigger?
A file that was already compressed hard, such as a small JPEG from a phone app, can grow when it is encoded again at a high quality, and a photo saved as PNG is almost always larger than as JPEG. The tool compares the new size with the file you loaded and warns you when it is larger. Lower the quality, choose another format, or reduce the longest side.
Should I resize or lower the quality?
For pictures shown on screen, resize first. File size follows the number of pixels closely, and a 4000 × 3000 photo shown 1600 px wide carries 4000 × 3000 ÷ (1600 × 1200) = 6.25 times the pixels it needs. Shrinking it keeps quality high where lowering the quality alone would make it blocky.
How do I use the Image Compressor?
Simply type your numbers and read the result, which refreshes the instant you change something. There is nothing to submit and nothing to wait for.
Do I need to install or sign up for anything?
Not at all — it runs in the browser with nothing to install and no account. After it loads once, it even works without an internet connection.
Is my information private?
Yes. Everything happens in your browser. Nothing you type is sent to a server or saved anywhere.
Common Use Cases
Website photos
Resize a 4000 × 3000 photo to 1600 px wide and save it as WebP or JPEG at quality 75 to 80 for a page that loads quickly.
Upload size limits
Forms that accept only files under 200 KB or 1 MB: Target size finds the highest quality that fits.
Email and messaging
Shrink a set of phone photos to 1600 px and JPEG quality 75 so they send quickly and still look sharp on screen.
Checking quality loss
Compare quality 60 with quality 90 at 100% and read the PSNR to see what the extra kilobytes buy.
Last updated: