All tools

How to compress images for the web without making them soft

Heavy images are the most common reason a page loads slowly. Google’s own image guidance says images are often the largest contributor to overall page size, which can make pages slow and expensive to load, and slow pages cost you visitors before they read a word. The fix is not one magic setting but a simple order of operations: pixel size first, format second, quality last. This guide walks through each step, with numbers you can use and the HTML that makes the browser do the rest.

Why it is worth the effort

Google recommends that sites aim for a Largest Contentful Paint (the time until the biggest visible element is drawn, very often a photo) of 2.5 seconds or less, measured at the 75th percentile of visits across mobile and desktop. It also states that its core ranking systems seek to reward a good page experience, of which Core Web Vitals are a part. Relevance still comes first, and a fast page with weak content will not outrank a slow page with the best answer. But among pages that answer the question equally well, the one that loads quickly keeps more visitors, and visitors who stay are good for everything else you care about.

1. Resize to the size it is shown

A modern phone takes photos around 4000 pixels wide. A blog column is usually 700–900 CSS pixels wide, and even on a high-density screen you rarely need more than twice that. Serving a 4000-pixel photo in an 800-pixel slot wastes most of the bytes before compression even starts. The saving is bigger than it looks: a 4032 × 3024 photo has 12,192,768 pixels, while the same photo at 1600 × 1200 has 1,920,000, only about 16% as many.

SlotGood width to export
Content image in an article1200–1600 px
Full-width hero1920–2400 px
Card or thumbnail400–800 px
LogoSVG if possible; otherwise 2× its displayed size

The “2×” reasoning: a screen with twice the pixel density draws two physical pixels for every CSS pixel, so a slot that is 800 CSS pixels wide looks sharp with a 1600-pixel image. Beyond 2× you are adding bytes the eye cannot use. Use the image resizer or the bulk resizer for a whole folder, and never enlarge a small image: upscaling cannot add detail, it only adds bytes.

2. Choose the format by content

More in JPG, PNG or WebP?, and if you want to know why these formats behave so differently, how image compression works explains it.

3. Set quality last, and check it

For photos, 70–80% quality is a common working range, and in everyday viewing the result is hard to tell from the original. That is a rule of thumb, not a law: it depends on the picture. Compare before and after at 100% zoom on the areas people look at: faces, text and product edges. If something softens, go up five points. The image compressor has a before and after view for exactly this. Quality also has diminishing returns: past a certain point each point you give up saves fewer bytes and costs more visible damage, which is why resizing comes first.

4. Set a budget per image

A useful rule of thumb is under 200 KB for a large content image and under 100 KB for most others. If you work to a budget, the exact-size tool finds the best quality that fits automatically, so you do not have to guess a slider value for every picture. A page-level budget is even better: decide the total image weight you will accept (say 500 KB above the fold) and work backwards.

5. Let the browser help

Good files still need good HTML. Three habits cover most of it:

Google’s documentation gives patterns you can copy. A responsive image with a fallback src:

<img srcset="cat-320w.jpg 320w, cat-480w.jpg 480w, cat-800w.jpg 800w"
     sizes="(max-width: 320px) 280px, (max-width: 480px) 440px, 800px"
     src="cat-800w.jpg" width="800" height="600"
     alt="A grey cat asleep on a windowsill">

And a modern format with a safe fallback, using the picture element:

<picture>
  <source type="image/webp" srcset="pyramid.webp">
  <img src="pyramid.jpg" alt="An oil painting of the Great Pyramid">
</picture>

Google adds that some crawlers and browsers do not understand srcset, so always include a plain src fallback, as in both examples.

6. Name and describe images properly

Speed is half the job. Google’s image guidance recommends short, descriptive file names (my-new-black-kitten.jpg rather than IMG00023.JPG) and calls alt text the most important attribute for image metadata. Alt text also helps people who use screen readers or have low-bandwidth connections. Write it for a person: describe the picture in context, and avoid stuffing it with keywords, which Google warns can make a site look like spam. Rename the files before you upload; it takes seconds and the benefit lasts.

A worked example

You have a 4032 × 3024 phone photo for a blog post, shown 800 pixels wide on desktop.

  1. Resize to 1600 pixels wide (1600 × 1200). The picture now has about 16% of its original pixels.
  2. Choose WebP, with a JPG copy for the fallback.
  3. Run it through the exact-size tool with a 150 KB budget and check the face and any text in the photo at 100% zoom.
  4. Name it harbour-sunset-lagos.webp, write the alt text, set width="1600" height="1200", and skip lazy-loading if it is the top image on the page.

Common mistakes

Quick checklist

  1. Resized to the display size (×2 for sharp screens).
  2. WebP or JPG for photos, PNG/SVG for graphics.
  3. Quality 70–80% and visually checked.
  4. Under your size budget.
  5. Width, height, alt text and a descriptive file name set in the HTML.
  6. Main image not lazy-loaded; everything below the fold lazy-loaded.

Sources

Checked 6 December 2026. Limits and policies change, so the provider’s own page always wins.

Frequently asked questions

What is the best image format for websites?

WebP for photos, with JPG as a fallback; SVG for logos and icons; PNG or lossless WebP for screenshots and diagrams. Google reports lossy WebP images are 25 to 34% smaller than comparable JPEGs.

What quality setting should I use?

For photos, 70 to 80% is a common starting point. Check faces, text and edges at 100% zoom, and raise it by five points if anything looks soft.

How big should a website image be in KB?

A common budget is under 200 KB for a large content image and under 100 KB for most others, but the right number depends on your page and your audience.