How to compress images without losing quality
To compress an image without visible loss, first resize it to the width it is actually shown at, then save it at a quality of about 70 to 85 in JPEG or WebP, and compare it with the original. Resizing saves the most, the right format saves more, and a free browser tool can do all of it in about a minute.
Why image size matters
Large images are one of the main reasons pages load slowly, especially on mobile data. The biggest image near the top of a page is often what counts as the Largest Contentful Paint, one of the three Core Web Vitals. Smaller images load faster, use less of your visitor’s data and help your page pass speed checks.
The two kinds of compression
- Lossless compression removes extra data without changing a single pixel. It saves a little.
- Lossy compression removes fine detail that the eye barely notices. It saves a lot, and the quality setting controls how much detail goes.
For photos, lossy compression is normal. For logos and screenshots with sharp text, use PNG or lossless WebP so the edges stay clean.
Step 1: Resize first
A phone photo may be 4,000 pixels wide, but your page may show it at 800 pixels. All the extra pixels are wasted. Resize the image to about the width at which it is displayed. For sharp, high-density screens, up to twice that width is plenty.
Typical sizes, which you should adjust to your own layout: about 1,200 pixels wide for an image inside an article, 1,600 to 1,920 pixels for a full-width banner and about 400 pixels for a thumbnail.
Step 2: Choose the right format
| Format | Best for | Notes |
|---|---|---|
| JPEG | Photos | Works everywhere. No transparency. |
| PNG | Logos, icons, screenshots and transparency | Files become large for photos. |
| WebP | Almost everything on the web | Often smaller than JPEG or PNG at similar quality. Current major browsers support it. |
| AVIF | Photos when you want the smallest size | Often smaller than WebP, but slower to create. Check that your tools support it. |
| SVG | Simple logos and icons | Tiny and sharp at any size. Not for photos. |
Step 3: Set the quality
Start at about 80 for photos and lower it step by step until you can see a difference at full size, then go back one step. For most photos a quality between 70 and 85 looks fine. Check faces, text and smooth gradients, because blocky patches show there first.
Do not compress an already compressed JPEG again and again. Each save loses a little more detail. Keep your original file and export new versions from it.
Rough size targets
These are rules of thumb, not rules. Many pages work well with a banner image under about 200 KB, normal content images under about 100 KB and thumbnails under about 30 KB. The total weight of your page matters more than any single image.
How to do it in your browser, free
- Open our free image compressor.
- Choose your image. It stays on your device and is not uploaded.
- Set a maximum width, for example 1,200 pixels.
- Choose WebP or JPEG and set the quality to about 75.
- Compare the sizes, look at the picture, and download the result.
Add images to your page correctly
After you compress an image, tell the browser its size and when to load it. A simple example:
<img src="/images/clinic-1200.webp" width="1200" height="800" alt="Reception area of the clinic" loading="lazy">
- Always set
widthandheight, so the page does not jump while the image loads. This protects your layout stability score. - Use
loading="lazy"for images below the first screen. Do not lazy-load the main image at the top of the page. - Write alt text that describes the image for people who cannot see it.
- Use
srcsetto give small screens a smaller file, if your site or platform supports it.
Common mistakes
- Uploading camera originals straight to the website.
- Stretching a small image to fill a wide space, which makes it blurry.
- Saving screenshots of text as JPEG, which makes the text fuzzy.
- Compressing the same file again and again.
- Using very large background images that visitors on phones never see properly.
- Putting text inside images instead of writing it as real text.
Where to go next
Images are only one part of speed. Read our Core Web Vitals guide for the full list, and how to increase website traffic for what to do once your pages are fast.