Performance

How to Optimize Website Images for Speed: Seven Steps in Order, With Our Own File Size Test

Most guides to optimizing website images say the same five things: pick the right format, compress, resize, lazy load, add alt text. They rarely tell you which step saves the most, or by how much. So we took one large image from our own work, exported it at five widths, in three formats and at seven quality levels, and wrote down every file size. The result changes the order you should work in. Sources read on 23 November 2026.

How to Optimize Website Images for Speed: Seven Steps in Order, With Our Own File Size Test

Key takeaways

  • Size comes before format. Our test image, a 2400 pixel wide master that weighs 14,092 KB as a PNG, became 657 KB as a WebP at full width and 180 KB at 800 pixels wide. Cutting the pixel width saved more than any other single change.
  • Export at the size the page needs. If a picture shows at 600 CSS pixels wide, a file about twice that wide covers sharp phone screens. Anything wider is bytes the visitor pays for and never sees.
  • WebP beat JPG at every size where it mattered. At the same quality number, WebP was 35% smaller at 2400 wide, 25% smaller at 1600 and 10% smaller at 800. At 400 wide they were the same.
  • The same quality number is not the same quality. AVIF at 80 was larger than WebP at 80, and AVIF at 60 was smaller, so compare the picture and the file size, not the setting.
  • The quality slider has a long flat end. At 1600 wide, WebP quality 95 was 899 KB and quality 80 was 430 KB, 52% smaller. From 80 to 60 saved another 29%.
  • Never lazy load the top image. web.dev says lazy loading an image near the top of the page can make it feel slower, and says the largest visible element is an image on more than 70% of pages.
  • Give every image a width and height. web.dev says this reserves the space and avoids layout shift.
  • Use real image tags for pictures you want found. Google says it does not index CSS images.

The short answer

Work in this order. First, resize each picture to about twice the width it shows at. Second, export it as WebP at a quality around 80 and look at it. Third, serve smaller versions to small screens with srcset. Fourth, lazy load the pictures below the first screen, and give the first big picture high priority. Fifth, set width and height on every image. Sixth, write real alt text and plain filenames. Seventh, measure the page before and after.

About us: Amariq is a web design studio. The test below is our own, run on 23 November 2026 on one image, and it measures file size only. Browser behaviour comes from web.dev and Google Search Central pages read the same day. We say below what we did not test.

What the search results show, and what they leave out

We searched Google (US, English) for "optimize website images" on 23 November 2026. The web results included Request Metrics' 2026 guide, TinyPNG, Google's image SEO page, Cloudflare's explainer on image optimizers, DebugBear's guide (dated 23 April 2026 in the result), Squoosh, a university guide, Webador's SEO tips and web.dev's image performance course. We read Google's page and the web.dev pages in full. For the rest we saw the result snippets only, so we do not describe them beyond what the snippets say: they list format choice, compression, resizing, dimensions and alt text.

That advice is sound. What the snippets do not show is how much each step is worth, so you cannot tell where to start. The test below fills that gap for one image. Your images will differ, which is why we also tell you how to repeat it.

Our test: one image, five widths, three formats, seven qualities

We used a photographic image from one of our own portfolio builds. It is a 2400 by 2999 pixel master saved as a PNG that weighs 14,092 KB. We resized it with high quality resampling and saved it with Pillow, a common Python imaging library, as JPG (progressive, optimized), as WebP (the slowest, smallest setting) and as AVIF. We measured file size only. We did not run a visual comparison, so judge the look of your own images yourself.

Width and format, both at quality 80

Width in pixelsJPGWebPWebP saving vs JPG
2400 (original width)1,018 KB657 KB35%
1600577 KB430 KB25%
1200380 KB306 KB19%
800201 KB180 KB10%
40062 KB63 KBnone

For scale, the 2400 pixel WebP is 4.7% of the PNG master, and the 800 pixel WebP is 1.3%. A page that shows this picture at 600 CSS pixels wide needs about 1200 pixels for sharp high density screens: 306 KB as WebP, against 657 KB if you uploaded the full width. That is the saving that comes from resizing, with no change in format.

Quality, at 1600 pixels wide

Quality settingJPGWebP
951,106 KB899 KB
90808 KB675 KB
85663 KB520 KB
80577 KB430 KB
70472 KB340 KB
60404 KB304 KB
50357 KB271 KB

WebP quality 95 to 80 cuts the file by 52%. From 80 to 60 cuts it by a further 29%. The numbers on different formats' sliders are not the same scale, so compare file sizes and your own eyes, not the setting. Our rule of thumb is to start near 80 and look at the picture at full size before going lower.

AVIF, and why the quality number is not a scale

We also saved the same widths as AVIF, with the same Pillow library, at quality 80 and at quality 60.

Width in pixelsWebP at 80AVIF at 80AVIF at 60
2400657 KB840 KB493 KB
1600430 KB533 KB309 KB
1200306 KB380 KB217 KB
800180 KB221 KB123 KB
40063 KB74 KB41 KB

At the same number, 80, AVIF came out larger than WebP. At 60 it came out smaller, by 25% at 2400 wide. That does not mean AVIF at 60 is the better file: the two encoders spend their quality settings differently, and we did not compare how the pictures look. The lesson is that a quality number only means something inside one tool. Compare the picture, then the file size.

What we did not test

One image is not a study. We did not test other kinds of picture such as screenshots or logos, how the files look, or how browsers decode each format. Pictures with flat colour and sharp lines behave differently from photographs. Run the same export on your own three heaviest pictures.

The seven steps

1. Resize to the size the page needs

Find the largest size each picture is shown at, in CSS pixels, and export a file about twice as wide for sharp phone and laptop screens. A hero that fills a 1440 pixel wide layout needs roughly 2880 pixels at most, and many sites can go lower. A card that shows at 400 pixels wide needs about 800. Our image resizer does exact sizes in your browser, with a setting that never makes a picture bigger.

2. Compress to a quality you have looked at

Open the exported picture at full size and compare it with the original. Lower the quality until you can see the difference, then go back a step. Our image compressor lets you aim for a quality or a file size and shows a before and after slider. It can also remove photo details such as camera data and place, which is a privacy point as well as a small saving.

3. Pick the format

Use WebP for photos on the page unless you have a reason not to. Our test shows the saving is largest on big files and nearly gone on small ones. Google Search supports BMP, GIF, JPEG, PNG, WebP, SVG and AVIF in the src of an image tag, and recommends the file extension match the type. Keep logos and icons as SVG where you can. Our WebP versus JPG guide covers when to convert back, and our JPG to WebP tool converts a folder at once.

4. Serve smaller files to smaller screens

The srcset attribute lets you list several widths of the same picture so the browser picks one. Google's documentation shows an example with 320, 480 and 800 pixel versions and says to always give a src fallback, because some browsers and crawlers do not understand srcset or picture. If your platform generates sizes for you, as most site builders do, check that it is switched on rather than writing the markup by hand.

5. Lazy load below the fold, and prioritise the top image

web.dev says the loading="lazy" attribute stops images being requested until they get near the viewport, and calls the fastest request the one that never happens. It also warns that lazy loading images near the top of the layout can make them feel slower. For the biggest picture in the first screen, which is often what Largest Contentful Paint measures, web.dev says never to lazy load it and to consider fetchpriority="high". web.dev reports that on more than 70% of pages the largest element in the first view involves an image. Our Core Web Vitals guide explains the score.

6. Set width and height on every image

web.dev's advice is to always put width and height on image tags, with values that match the file's own size, and to keep max-width: 100% and height: auto in your CSS. Browsers then work out the aspect ratio before the file arrives and reserve the space, which avoids the page jumping as pictures load.

7. Name it, describe it, and keep it findable

Google says it finds images in the src of image tags and does not index CSS images, so a picture you want in image search should not be a CSS background. Use short descriptive filenames, not IMG00023.JPG. Write alt text that describes the picture in context and does not stuff keywords. Use the same URL for an image wherever it appears. Choose a relevant, high resolution image for og:image, not a logo or a picture with text. Our photographer website guide has a measurement of alt text on real home pages.

Check the result

Run PageSpeed Insights on the page before and after, and compare the Largest Contentful Paint and total page weight. Our speed testing guide explains why scores vary between runs, and our speed optimization guide for small sites puts images in the wider order of fixes. web.dev's course also notes that images were nearly half of a median page's weight when it was written in 2022, so images are usually the place to start.

How Amariq can help

We export every image on the sites we build at the sizes the layout needs, check the result against the budget above and keep the originals for you. Projects are quoted from their scope, never from hours worked. You pay 40% to begin, 30% when you approve the design and 30% before launch. After the final payment the design, copy and code are yours, and your domain, hosting and analytics accounts are opened in your name. See our web design service or get in touch.

Frequently asked questions

What is the best way to optimize images for a website?

Resize each picture to about twice the width it displays at, export it as WebP at a quality you have checked by eye, give it width and height, lazy load it only if it is below the first screen, and describe it with alt text. In our test, resizing saved more than any other single step.

What is a good file size for a website image?

There is no official number. In our test, a 2400 by 2999 photographic image came out at 657 KB as WebP at full width and 180 KB at 800 pixels wide. Aim for the smallest file that still looks right at the size it is shown, and measure the whole page with PageSpeed Insights.

Is WebP better than JPG for websites?

In our test it was smaller at the same quality setting: 35% at 2400 pixels wide, 25% at 1600 and 10% at 800, with no difference at 400. Google Search supports WebP images in the src attribute. See our WebP versus JPG guide for when to keep a JPG.

Should I lazy load all images?

No. web.dev says to lazy load images below the first screen, and never to lazy load the large picture at the top, because it can slow the page's Largest Contentful Paint.

Do image file names and alt text matter for SEO?

Google says the filename gives light clues, and alt text is the most important attribute for metadata. It asks for short descriptive filenames and informative alt text without keyword stuffing.

Can I optimize images on WordPress, Webflow or Shopify without code?

Yes. Resize and compress before you upload, and check what your platform does with the file afterwards. Our free image tools run in your browser, so the pictures stay on your computer.

Rahat Khondokar, founder of Amariq

Rahat Khondokar

Founder & CEO, Amariq

Rahat designs and builds websites for marketing teams and ecommerce brands, and writes here about the structure, copy and conversion work behind them. More about Amariq. Find him on YouTube, Dribbble and LinkedIn.

Keep reading

Related articles.

All articles