Skip to content

Web Development

How to Optimize Images for a Faster Website

Learn how to optimize images for the web: right size, compression, WebP and AVIF, lazy loading and alt text — for faster pages and better SEO.

Optimize images for a faster website

Images make websites attractive — and often make them slow. On many sites, images account for most of the page weight. If you optimize images properly, pages load faster, rank better and convert more. Here’s how.

Why image optimization matters

  • Faster loading, especially on mobile data
  • Better Core Web Vitals — LCP is often an image
  • Lower hosting bandwidth
  • Better image search visibility

Step 1: Resize before uploading

Don’t upload a 5000px camera photo for a 1200px space. Resize to the largest size it will display — typically 1200–1920px wide for full-width images.

Step 2: Choose the right format

Format Best for
WebP Most photos and graphics — small files
AVIF Even smaller files, modern browsers
JPEG Photos when WebP isn’t possible
PNG Graphics needing sharp edges or transparency
SVG Logos and icons

Step 3: Compress

Compression reduces file size with little visible loss. Use tools like Squoosh, TinyPNG or a WordPress plugin (LiteSpeed Cache, ShortPixel, Imagify). Aim for most images under 200 KB.

Step 4: Use lazy loading

Images below the screen should load only when users scroll to them. WordPress does this automatically — but don’t lazy-load the hero image; it should load first.

Step 5: Set width and height

Defining dimensions prevents layout jumps (CLS).

Step 6: Use responsive images

WordPress creates multiple sizes and uses srcset so phones download smaller versions.

Step 7: Write good alt text and file names

  • File name: dhaka-office-renovation.webp, not IMG_4532.jpg
  • Alt text describes the image for screen readers and search engines

Step 8: Use a CDN

A content delivery network serves images from servers near your visitors.

Image optimization checklist

  • ☐ Resized to display size
  • ☐ WebP or AVIF format
  • ☐ Compressed
  • ☐ Lazy loading (except hero)
  • ☐ Width and height set
  • ☐ Descriptive file name and alt text

Key Takeaways

  • Images are often the biggest cause of slow pages.
  • Resize, compress and use WebP or AVIF to optimize images.
  • Lazy-load below-the-fold images but not the hero.
  • Alt text and file names help accessibility and SEO.

Further reading: web.dev: Image performance

Frequently Asked Questions: How to Optimize Images

Will compression make images blurry?
Not with sensible settings — quality 75–85 usually looks the same.

Can I optimize images already uploaded?
Yes — most optimization plugins can bulk-process your media library.

Do portfolio sites need extra care?
Yes — see how to create a portfolio website.

Want a faster website?

Makto Mine optimises images and performance for WordPress sites. Talk to us.

Related: What Is a Website Sitemap?

Leave a comment

Your email address will not be published. Comments are moderated before they appear.

Have a project in mind?

Tell us what your business needs. You will get a clear recommendation, a scope and a quotation — no obligation.