Skip to content
ع
Web Development

Image Optimisation for the Web: Modern Formats, Sizes and Compression for Faster Pages

Images are often the heaviest part of a page. Optimising them with a few simple steps speeds up mobile pages, improves Core Web Vitals and opens the door to image search.

Ahmad Khreiswebmaster5.0(2)
Published Updated 15 min read
Illustration for the article: Image Optimization for Websites: Choosing Between JPG, PNG, WebP, AVIF and SVG

Open any slow page and look for the cause, and you'll usually find it in the images: a hero image thousands of pixels wide, an old format and no compression. Image optimization is one of the fastest-impact improvements you can make: it shrinks the page, speeds it up on mobile, improves LCP and opens the door to image search. The good news is that it only takes a few simple, regular steps.

Key takeaways

  1. 1Choose the format by image type: WebP or AVIF for photos, SVG for logos and icons.
  2. 2Serve the image at the size it's displayed, with several sizes for different screens.
  3. 3Lazy-load only images below the first screen; load the hero image immediately.
  4. 4Write alt text that truly describes the image, and set its dimensions in the code.

Image optimization: the same image, lighter at every step

There's no single magic setting. A heavy image gets lighter with each step, and the final result looks almost identical to the eye:

An image's journey from camera to page

  1. The original photo

    Full camera dimensions and a large file

  2. Resize

    To the largest width it's actually displayed at

  3. Compress

    At a quality visitors can't tell apart

  4. Modern format

    WebP or AVIF instead of older formats

An illustration of the idea: each step cuts the size, and together they're the difference between a slow page and a fast one.

1. Choose the right format for each image

Each format excels at something. Picking the wrong one can double an image's size for no benefit:

FormatBest forNotes
JPEGPhotographsSupported everywhere, but modern formats are usually smaller
PNGGraphics needing lossless detail or transparencyHeavy for photographs
WebPPhotos and graphics generallySupports lossy, lossless and transparency, with wide support
AVIFPhotos when you want the smallest fileOften higher compression, slower to encode
SVGLogos, icons and simple graphicsSharp vectors at any size, very small files

You can convert formats directly with the Image Converter.

Google's web.dev site has a useful explainer on how to choose the right image format, comparing formats by type of image, transparency needs and quality.

An illustrative example: three images on one page

Imagine a service page with three images: a photo of the team at the top, the company logo and a simple illustration of the service steps. The photo suits WebP or AVIF with moderate compression. The logo suits SVG, because it stays sharp at any size and weighs very little. The flat-colour illustration may also be SVG if it was drawn as a vector, or PNG if it's a bitmap with fine lines. Using one format for every image usually means some of them are heavier than they need to be.

2. Serve the right size for every screen

A 3000-pixel-wide image shown in a 400-pixel space on a phone means visitors download many times what they need. The fix comes in steps:

  1. 1
    Resize before uploading

    To the largest width the image will be displayed at, using the Image Resizer.

  2. 2
    Provide several sizes

    With srcset and sizes, so the browser picks the right one for the screen automatically.

  3. 3
    Set dimensions in the code

    Width and height or an aspect ratio, so the page doesn't jump while loading.

3. Compress without anyone noticing

Most images tolerate heavy compression before the eye notices any difference. Try different levels and compare the result on the kind of screen your visitors use. Compress images with the Image Compressor, and crop out unimportant areas with the Crop and Rotate tool.

Judge quality with your eyes, not just the numbers

A compression tool gives you a quality number, but the real judge is your own eye. Open the original and compressed versions side by side at the size they'll appear on the page, not zoomed in. If you can't see a difference, compress a little more and repeat, stopping at the first level where edges or colour gradients start to look noisy. This finds the smallest acceptable size for each image, and it's the heart of practical image optimization.

4. Image SEO: helping Google find and understand them

Descriptive alt text

Describes what's in the image and its role on the page, serving screen readers as in our accessibility guide.

Meaningful file names

Such as website-speed-report.webp instead of IMG_2034.jpg.

Images near related text

The context around an image helps the engine understand its subject.

Original images

Real photos of your work and team beat stock images repeated on thousands of sites.

Google summarises its recommendations on its Google Images SEO best practices page, including placing images near related text, using descriptive file names and writing alt text that genuinely describes what the image shows.

Common image optimization mistakes

Uploading photos straight from the camera. A phone photo can be over four thousand pixels wide, while it appears on the page at eight hundred. Resize before uploading, or make sure your platform does it automatically.

Lazy-loading the first image. Lazy loading helps images further down the page, but it hurts the hero image visitors see immediately and delays LCP.

Forgetting dimensions. An image without a set width and height makes the page jump while it loads. Set the dimensions or aspect ratio for every image.

Keyword-stuffed alt text. "web design image best web design Riyadh" describes nothing. Write a short sentence describing what's actually in the image, as if explaining it to someone who can't see it.

Treating it as a one-off job. New images are added every week, and each one can undo earlier work. Build image optimization into your publishing routine, with a size limit and a format rule everyone on the team follows.

A practical one-week plan

On day one, test your five most important pages with a speed tool and note the image weight on each page and its LCP. Over the next two days, convert the large images on those pages to a modern format, resize them to the width they display at and set their dimensions. Then add lazy loading to images below the fold only, and review the alt text on every image. At the end of the week, measure again and compare. You'll usually see a clear difference in weight and speed, and you'll know exactly which step had the biggest effect, so you can make it a fixed rule for every new image uploaded to the site.

Conclusion

Image optimisation is a chain of simple steps: the right format, the right size with alternatives for each screen, compression nobody notices, lazy loading only below the first screen, and descriptive alt text. That alone may be the biggest speed improvement on your site, as covered in our website speed guide. If you'd like a site that optimises images automatically on upload, explore our website development service.

Frequently asked questions

Which image format should my site use?

WebP is a balanced, widely supported choice for photos and graphics, AVIF is often smaller still, SVG suits logos and icons, and PNG fits when you need lossless detail.

Should I lazy-load every image?

No. Lazy-load only images below the first screen. The main hero image must load immediately and with priority, or LCP suffers.

Does alt text affect SEO?

Yes, it helps Google understand the image and show it in image search, and it serves screen reader users. Write a real description, not a keyword list.

What size should a hero image be?

There's no single number, but the rule is to make its width close to the largest size it will actually display at, and to serve smaller versions to smaller screens. The hero image is usually the largest element on the page, so compress it carefully, and don't lazy-load it, because it's the first thing visitors see.

Should I convert all my site's old images to WebP?

Not necessarily all at once. Start with your most visited pages and the largest images, since they make the biggest difference. Many platforms and content delivery networks can also convert formats automatically when serving images, so check that before converting files by hand.

Sources & references

  1. web.dev — Choose the right image format
  2. MDN — Image file type and format guide
  3. Google Search Central — Image SEO best practices
Ahmad Khreis

About the author

webmaster

I believe technology is useful when it solves a clear problem — not when it's adopted because it's trendy. AI is a powerful tool for speeding up research, writing, analysis and automation, but it needs human expertise to review, guide and verify accuracy. That's why I prefer to start by understanding the business and its goals, then choose the simplest solution that delivers a measurable result, and build audience trust with honest, useful content.

Reader rating
5.0(2)
Published articles
81
  • #image optimization
  • #webp
  • #performance
Share

How would you rate this article?

Be the first to rate

Comments

No comments yet. Share your thoughts!

Leave a comment

Related articles