How to Compress an Image
There are three levers for making an image smaller: fewer pixels, lower quality, or a more efficient format. Resizing usually does most of the work, and it is the one people skip.
The three levers
| Lever | Effect on size | Effect on quality |
|---|---|---|
| Resize | Large, roughly quadratic | None if still large enough |
| Quality setting | Large, adjustable | Visible below about 70 |
| Change format | Moderate to large | Depends on content |
In practice, resizing a phone photo to 1,600 pixels and saving at quality 82 takes a 4 MB file to under 300 KB with no visible difference on screen.
Compress and resize JPG, PNG and WebP in the browser.
Open the Image Compressor →Why resizing matters most
File size grows roughly with the number of pixels, so halving the width and height cuts the pixel count to a quarter.
A 12-megapixel photo displayed in a 1,200-pixel-wide slot on a web page is wasting nine tenths of its pixels. The browser throws them away, but the reader downloads them first.
Choosing a target size
| Use | Width in pixels | Notes |
|---|---|---|
| Full-width web image | 1,600 | Retina screens benefit from double |
| In-article image | 800 to 1,200 | |
| Thumbnail | 300 to 400 | |
| Email attachment | 1,200 to 1,600 | |
| Print at A4, 300 DPI | 2,480 | Do not compress for print |
Pick the width from where the image will appear, not from the camera.
Quality settings
JPG quality runs from 0 to 100. Below about 70 the artefacts become visible around edges and text; above 85 the file grows quickly for little visible gain.
85 is a sensible default. For a photograph with fine detail, compare at 100% before committing.
Format choice
JPG is efficient for photographs. PNG is lossless and much larger for photos, but better for screenshots, logos and anything with sharp edges or transparency.
WebP is usually smaller than both at comparable quality and is supported by current browsers. It is the best default for the web when compatibility allows.
PNG is not a compression lever for photos
Re-saving a photograph as PNG often makes the file several times larger, because PNG cannot discard the subtle detail that JPG discards.
If a PNG is large and contains a photo, convert it to JPG or WebP instead of trying to compress it as PNG.
Transparency
JPG has no transparency. Converting a transparent PNG to JPG fills the transparent areas with a colour, usually white or black.
If the image needs transparency, keep PNG or use WebP, which supports it.
Checking the result
Look at the compressed image at 100% next to the original, on the kind of screen it will be viewed on. Artefacts around text and high-contrast edges show up first.
For a web page, check the file size in kilobytes as well as the appearance. A file that looks fine at 900 KB may still be too large for a mobile connection.
Privacy
Compression in the browser keeps the image on the device. Uploading to a service sends a copy, which matters for personal photos.
Prefer a local tool for anything private.
Common mistakes
- Lowering quality to 30 when resizing would have done the job.
- Keeping a 4000-pixel image for a 300-pixel slot.
- Converting a transparent PNG to JPG and losing the transparency.
- Re-saving a photo as PNG.
- Judging the result at fit-to-window zoom instead of 100%.
Compression and the web
A page that loads three 900 KB images feels slow on a phone even on a good connection. Resizing those images to the slot width and saving at quality 82 can take the page from several megabytes to a few hundred kilobytes.
The change is invisible to the reader and noticeable in the loading time, which is the best kind of improvement.
Keeping a master copy
Always keep the original file. Compression is one-way for JPG, and a compressed image cannot be restored to its earlier detail.
A simple folder structure, with an originals folder and an export folder, prevents the moment when someone asks for a larger version and there is none.
Frequently asked questions
What is the best quality setting for JPG?
About 80 to 85 for most uses. Below 70 the artefacts show.
Should I resize or compress first?
Resize first, then compress. Resizing usually does more.
Does compression lose quality permanently?
Yes for JPG. Keep the original if you may need it again.