Lizzard Solutions

Image Optimization for Websites: Formats, Sizes, Lazy Load

· Lizzard Solutions
Image OptimizationWebsite SpeedCore Web VitalsWeb DevelopmentSEO

By Nemanja Vukmirović, Lizzard Solutions. Last updated 18 November 2026.

You open your homepage on a phone and the big header photo appears line by line. The page looks finished only after a few seconds. In many cases the cause is not hosting or code but a single image that is far heavier than it needs to be.

This guide explains image optimization for websites in plain terms: which format to use, what size to export, how lazy loading and responsive images work, and how to check the result. It includes a small compression test we ran ourselves, so you can see real file sizes instead of promises.

TL;DR

  • Export images at the size they are actually displayed, then compress them. Size first, format second.
  • Use WebP (or AVIF) for photos and illustrations, SVG for logos and icons, PNG only when you need lossless detail.
  • Lazy-load images below the fold, never the main hero image, and always set width and height to prevent layout shifts.

What is image optimization for websites?

Image optimization for websites is the process of delivering each image in the right format, at the right pixel size and with the right compression, so it looks sharp on the visitor's screen while downloading as few bytes as possible and without slowing down or shifting the page.

It covers four decisions: the file format, the dimensions, the compression level and how the browser loads the image. Google's Learn Images course on web.dev treats all four together, and so should you.


Why images slow down small business websites

Images are usually the largest files on a page. A photo straight from a phone or a stock site is often several thousand pixels wide, while your layout shows it at a fraction of that. The browser still downloads every pixel.

The main hero image is also often the Largest Contentful Paint element, the metric Google uses to judge how fast the main content appears. Our explainer on Core Web Vitals covers LCP, INP and CLS, and web.dev explains LCP in detail.

Example

A local dental clinic uploads a 4000-pixel photo of its waiting room as the homepage banner. On desktop the banner is shown 1200 pixels wide, on phones around 400. Every visitor downloads the full photo anyway. Resizing and converting that one file is often the fastest speed win on the whole site.

Action for today: open your homepage, right-click the largest image and check its real dimensions against the space it fills on screen.


Our test: one image, six versions

We took the 1280×720 illustration used as this article's cover and saved it in common formats with the Python Pillow library (version 13). These are the measured file sizes:

VersionFile size
PNG (lossless)370.7 KB
JPEG, quality 9094.6 KB
JPEG, quality 7552.4 KB
WebP, quality 8026.2 KB
AVIF, quality 6021.5 KB
WebP, quality 80, resized to 640×36010.7 KB

Key takeaway: in this test, WebP at quality 80 was just over a quarter of the high-quality JPEG and roughly 7% of the PNG, and resizing to the display size cut it by more than half again.

Limits of this test

This is one flat illustration. Real photos with fine detail compress differently, and quality numbers are not equal across formats. Run the same comparison on your own images and judge by eye before you choose settings.


Choosing the right image format

FormatUse it forAvoid it for
WebPMost photos and illustrations on the webLogos that must stay perfectly crisp at every size
AVIFPhotos where you want the smallest file and your tools support itWorkflows where your CMS or CDN cannot generate it
JPEGFallback for old systems, email imagesGraphics with text or sharp edges
PNGScreenshots and graphics that need lossless detail or transparencyLarge photos
SVGLogos, icons, simple diagramsPhotos

Browser support for modern formats is broad today. Check current numbers for AVIF support on Can I use before dropping fallbacks for an audience that uses older devices.

Action for today: list the image types on your site (photos, logos, icons, screenshots) and assign one format to each.


Resize and compress before you upload

  1. Measure the display width. Use the widest size the image is shown at, then export at about twice that width for sharp retina screens, not more.
  2. Crop to the layout. A 16:9 banner should be exported as 16:9, not as a tall photo the browser has to crop.
  3. Compress with a visual check. Start around quality 75 to 82 for WebP and lower it until you see artefacts, then step back.
  4. Strip metadata. Camera data such as location adds bytes and can reveal private information.
  5. Name files descriptively. dental-clinic-waiting-room.webp helps people and search engines more than IMG_4821.jpg.

If you use WordPress, an image optimization plugin or your CDN can convert and resize uploads automatically. Check that it does not create dozens of unused sizes. Our website speed optimization guide shows where images fit among the other speed fixes.


Responsive images with srcset and sizes

Responsive images let the browser pick the smallest file that still looks sharp on each screen. You list several widths in srcset and describe the layout in sizes:

<img src="hero-1200.webp"
     srcset="hero-640.webp 640w, hero-1200.webp 1200w, hero-1800.webp 1800w"
     sizes="(max-width: 700px) 100vw, 1200px"
     width="1200" height="630"
     alt="Dentist explaining treatment to a patient"
     fetchpriority="high">

MDN's guide to responsive images explains every attribute. The width and height attributes let the browser reserve space before the file arrives, which prevents the layout shifts measured by CLS.


Lazy loading: what to load later, and what not to

Native lazy loading tells the browser to fetch an image only when the visitor scrolls near it:

<img src="team-640.webp" width="640" height="427" alt="Lizzard Solutions team at a workshop" loading="lazy">
  • Lazy-load: galleries, team photos, blog images and anything below the first screen.
  • Do not lazy-load: the hero image or logo at the top. Delaying them makes LCP worse. Give the hero fetchpriority="high" instead.
  • Check your CMS: many themes add lazy loading to every image automatically, including the hero. Inspect the page source to confirm.

See MDN on lazy loading for the browser behaviour behind it.


Alt text and image SEO

Alt text describes the image for screen readers and gives search engines context. Write what the image shows in one short sentence, without stuffing keywords. Decorative images can use an empty alt="".

Google's image SEO best practices also recommend descriptive file names, images placed near relevant text and standard HTML image elements. For the wider picture, see our technical SEO guide for small business websites.


Image optimization checklist

  • Every image is exported close to its maximum display size (up to 2× for retina).
  • Photos and illustrations use WebP or AVIF, logos and icons use SVG.
  • Hero image is not lazy-loaded and has fetchpriority="high".
  • All other images below the fold use loading="lazy".
  • Every image has width and height attributes.
  • Large images offer several widths through srcset and sizes.
  • Alt text is written for people, file names describe the content.
  • Speed is re-tested after changes, on mobile.

To see whether images are still the bottleneck on your site, run our free website speed check. It highlights heavy pages without any setup.


Frequently asked questions

What is the best image format for websites?

For most photos and illustrations, WebP is the safest default because it is small and widely supported. AVIF can be even smaller when your tools support it. Use SVG for logos and icons and PNG only for graphics that need lossless detail or transparency.

What size should website images be?

Export each image at the largest width it is displayed at, and up to twice that for high-density screens. A banner shown 1200 pixels wide rarely needs to be wider than 2400 pixels, and a blog thumbnail shown at 400 pixels needs far less.

Should I lazy-load all images?

No. Lazy-load images below the first screen, but load the hero image and logo normally. Lazy-loading the main visible image delays Largest Contentful Paint and makes the page feel slower.

Does image optimization help SEO?

Yes, indirectly and directly. Lighter images improve page speed and Core Web Vitals, which affect user experience. Descriptive file names, alt text and nearby relevant text help search engines understand images and can bring traffic from image search.

Need help beyond images? See our web development services, from speed audits to full site rebuilds.

Make your website load faster

Send us your site and we will find the heaviest images and other speed bottlenecks, and tell you exactly what to fix first. Book a free consultation.

Book a free consultation