Skip to content

Chapter 4 · On-Page SEO

Image Optimization

Serve appropriately sized, visually clear, crawlable images with context-appropriate alt text, and prioritize loading the image users need first.

Updated November 8, 2026 · By · Reviewed by Robin Rad

· 9 min read

Quick answer: Image optimization is the process of making website images efficient to load, accessible to users, and understandable to search engines. It combines suitable formats, compression, responsive dimensions, meaningful alternative text, and crawlable image markup. The goal is to preserve useful visual quality while reducing download costs and supporting image discovery.

Key facts

TL;DR: Serve appropriately sized, visually clear, crawlable images with context-appropriate alt text, and prioritize loading the image users need first.

Alt text
A text alternative supplied through an image’s alt attribute that communicates its meaning or function in context.
Image compression
Reducing an image’s encoded file size through lossless methods or lossy methods that trade some visual information for smaller downloads.
Responsive images
Image markup that lets the browser select a suitable source for the layout, display density, and supported formats.
Intrinsic dimensions
An image’s native width and height, distinct from the size at which the page displays it.
Chair photograph cropped and compressed for detailed desktop and mobile product views

What is image optimization?

Image optimization makes website images easier to load and use. It also gives search engines clues about what each image shows.

Say you run an online furniture shop. A chair photo needs to show the fabric clearly, but a small product preview doesn’t need the same file as a full-screen view. You can export a smaller version for the preview, then check that buyers can still see the detail they need.

Compression reduces file size. Optimization goes further: you need to check how the image loads on the page and what users get when they can’t see it. As part of on-page SEO, the image should serve the page’s purpose.

There’s no single best way to compress every image, as web.dev explains. Start with the image’s job, then test the export:

  1. Choose a clear source. Keep the detail your reader or buyer needs.
  2. Export for its placement. Compare file size and quality at the size people will see.
  3. Add the image to the page. Set its text alternative and loading behavior.
  4. Check the live result. Confirm that it looks right and that the browser loads the right file.

A detailed product view may need more image data than a small preview. Don’t force both into the same file-size limit.

Why does image optimization matter for SEO?

Large image files can delay visible content, especially on a slow mobile connection. Useful alt text gives people access to image information when they can’t see the image. The right HTML also lets Google find images for search.

Core Web Vitals measure loading speed and how the page behaves as people use it. Smaller image files can address part of that work, but compression alone doesn’t ensure better rankings.

  • Timely display: Don’t lazy-load the image that forms the Largest Contentful Paint, or LCP. That delays its request and worsens LCP, as web.dev explains.
  • Stable placement: Reserve space for images so they don’t push content around as they load. Use width and height attributes or an equivalent method, per web.dev.
  • Accessible meaning: Write alt text that conveys the image’s purpose. Google Search Central warns against stuffing it with keywords.
  • Image discovery: Google finds images through the src attribute of img elements, including those inside picture elements. It doesn’t index CSS background images, according to Google Search Central.

Google Images offers a route to your site alongside other search result features. Clear images also make it easier for people to inspect products or follow instructions.

Choose a format and compression level for the image

Your choice of format affects both image quality and download size. Start with the type of image you have.

FormatWhen to consider it
JPEGPhotos that need broad support.
PNGRaster images that need lossless detail or transparency.
WebP and AVIFModern formats worth testing against your current export.
SVGVector artwork, such as logos and icons.

PNG isn’t the only format that supports transparency. Nor is WebP or AVIF always the smallest choice. Compare exports at the dimensions you need, then check their quality, as web.dev recommends. Google Search supports AVIF with no special indexing steps, according to Google Search Central.

Compare exports before publishing

Lossy compression removes some image detail to reduce file size. Lossless compression keeps the image data intact, but files may be larger. Tools such as Squoosh or ImageOptim can help you test exports; TinyPNG is another option.

  1. Keep the original. You’ll need it if you want a fresh export later.
  2. Resize a copy. Match it to the intended display needs.
  3. Compare formats and quality settings. Don’t rely on a fixed file-size limit.
  4. Check the detail. Look for blurred text or rough edges at the size users will see.
  5. Publish the suitable export. Choose a file that keeps useful detail without needless download weight.

Page speed optimization covers loading issues across the rest of the page.

Write useful alt text and descriptive filenames

Alt text explains an image’s purpose when someone can’t see it. A filename gives a much lighter clue about its subject.

Match alt text to the image’s purpose

For an informative image, describe what matters in context. You might use alt=”Blue running shoes with reflective heel panels” when those details matter to the page.

For a purely decorative image, use alt=””. W3C recommends an empty alt attribute, not a missing one. The empty value tells assistive tools that the image can be skipped.

For an image used alone as a link or control, name its purpose. A search icon that acts as a button could use “Search.” Describe the action, not the icon’s shape.

Keep alt text brief without losing needed meaning. There’s no universal character limit to aim for. Google Search Central recommends useful descriptions that fit the page and warns against keyword stuffing.

Choose short, descriptive filenames

Use a name such as blue-running-shoes.webp rather than a camera-generated filename. Google recommends short, descriptive names but says they provide only very light clues about the subject, as explained in Google Search Central.

Web accessibility covers access needs beyond image alternatives.

On-page keyword optimization covers page-level placement; don’t turn alt text into a list of search terms.

Serve responsive images and load them at the right time

Responsive images let the browser choose a file that suits the screen and page layout. That can avoid sending a large source file for a small display slot.

Match sources to the layout

Check both the image’s display size and the screen’s pixel density. A dense screen may need more source pixels to keep the image sharp.

The markup below is a template, not ready-to-use HTML. Replace the bracketed placeholders with values from your image files and CSS layout, and use your own fallback image URL.

<img src=”garden.jpg” srcset=”[image URLs with their actual width descriptors]” sizes=”[display slot sizes and matching media conditions]” width=”[source image width]” height=”[source image height]” alt=”Raised vegetable beds beside a gravel garden path” >

  • src gives the browser a fallback image URL.
  • srcset lists the files and their actual pixel widths.
  • sizes describes the expected display slot. It must match the page layout.
  • width and height give the image’s proportions so the browser can reserve space. That reduces layout shifts, per web.dev.

Use picture when you need to offer different formats or crops. Keep an img element with a fallback src inside it, as Google recommends.

Prioritize visible images

Use loading=”lazy” for suitable images farther down the page. The browser may fetch them before they scroll into view.

Don’t lazy-load the LCP image, because that delays its request, per web.dev. Consider fetchpriority=”high” for the likely LCP image, rather than adding it to every image.

Page speed optimization covers broader loading issues; mobile optimization covers the wider mobile experience.

Make important images discoverable by Google

Google needs to find and access an image before it can consider it for search. Nearby text gives the image context.

  1. Use HTML image elements. Put important images in img elements, including those inside picture elements. Google finds images through img src attributes, but doesn’t index CSS background images, according to Google Search Central.
  2. Keep a usable src URL. Include a fallback image URL even when you use srcset or picture, as Google recommends.
  3. Check crawler access. Make sure the image and its page load without a sign-in. Check robots.txt for rules that block access by mistake.
  4. Place images near relevant text. Add a caption if it explains something useful, such as a chart’s meaning. You don’t need a caption for every image.

Image sitemaps can support discovery, especially on sites with many images. Consult the sitemap guide for current syntax.

Structured data can describe images within eligible content types, but it doesn’t ensure an enhanced search appearance.

Common image optimization mistakes to avoid

Check for these problems when you publish an image or change a page template.

  • Too much compression: If useful detail is lost, try a different setting or format. No approach suits every image, as web.dev explains.
  • Resizing only with CSS: A small display slot can still download a large original. Serve a file sized for the job.
  • Keyword-stuffed alt text: Replace search-term lists with a useful description, as Google advises.
  • Describing decoration: Use alt=”” for purely decorative images, per W3C.
  • Giving filenames too much weight: Choose descriptive names, but treat them as light clues, not a major ranking factor, per Google.
  • Lazy-loading every image: Exclude the LCP image, as web.dev advises.
  • Leaving no space for images: Set width and height or reserve the aspect ratio to reduce shifts, per web.dev.
  • Omitting the fallback: Keep an image URL in img src when using srcset or picture, as Google recommends.

Social previews use separate metadata. See Open Graph and Social Sharing rather than assuming your page image controls the preview.

How do you check whether image optimization worked?

Test a sample of your page templates before and after the change. Use the same screen size and network settings so the comparison is useful. Check the files the browser receives, not just the originals you uploaded.

  1. Inspect the loaded files. In browser developer tools, check which image source was chosen and how much data was sent. Look at when its request started, too.
  2. Review quality and meaning. View the image at a realistic size. Check for lost detail and make sure its alt text fits the page.
  3. Compare performance. Use PageSpeed Insights or Lighthouse to find loading and layout issues. Keep lab tests separate from real-user data. Good LCP is 2.5 seconds or less for at least 75% of page visits, per web.dev. See Core Web Vitals for help interpreting the metric.
  4. Monitor search discovery. Use the Image search type in Google Search Console to track impressions and clicks to your site. A change in those figures doesn’t prove that compression caused it.

Image publishing checklist

Use these checks as the image sign-off within an on-page SEO audit. Repeat them after a template change.

  • The live image looks clear, and the browser loads a suitable source size.
  • Alt text fits the image’s purpose, without keyword stuffing, per Google. Decorative images use alt=””, per W3C.
  • The img src attribute contains a fallback URL, as Google recommends.
  • The LCP image isn’t lazy-loaded, per web.dev.
  • Space is reserved through width and height attributes or an equivalent method, per web.dev.

Frequently asked questions

Can I optimize images for free?

Yes. Free tools can resize and compress images. Keep the original, then compare exports at the size you’ll use on the page. The right choice depends on the image, so don’t choose on file size alone, as web.dev explains.

What is the best image optimization software for my website?

Start with Squoosh if you want to compare formats and quality settings for an individual image in your browser. TinyPNG is a simple starting point for uploading a batch of files for compression. If you use a Mac and prefer to process files locally, consider ImageOptim.

For an automated website workflow, check which formats your CMS supports and whether it creates responsive image sizes. Test any tool on your own images before you adopt it. No tool is best for every image: the right compression choice depends on the content and the detail you need to keep, as web.dev explains.

Should I rename existing image files that already receive search traffic?

Usually, leave them alone unless there’s a clear reason to change them. Renaming a file changes its URL if the filename is part of that URL. Google says descriptive filenames provide only very light clues about image content, according to Google Search Central. If you must rename a file, redirect its old URL and update references on your site.

Do images need a title attribute as well as alt text?

No. A title attribute can add extra information, but it doesn’t replace alt text. Write alt text that fits the image’s purpose on the page, as Google Search Central advises. For purely decorative images, use alt=”” rather than a description or a missing attribute, per W3C WAI.

Sources

  1. Choose the correct level of compression
  2. Optimize Largest Contentful Paint
  3. Optimize Cumulative Layout Shift
  4. Google image SEO best practices
  5. Supporting AVIF in Google Search
  6. Decorative Images

About the author: writes the Deep SEO SEO Encyclopedia, a 2026 reference on technical, on-page, local and AI search. Every entry cites the sources linked in its text and is reviewed by Robin Rad before publication.

Back to top
WhatsApp +968 9182 2962