SEO & GEO

What Are HTML Image Elements?

Images are often the heaviest things on a web page and, at the same time, among the most neglected. A single oversized photo can slow a page more than all its text and code combined, and a missing description can leave a screen-reader user with no idea what they are missing.

The HTML behind images is small, but each part of it does a real job. This entry in the series covers the img element, the attributes that matter most, and the related elements that help images load faster and look right on every screen.

The Basic img Element

<img src=”/images/team-photo.jpg”     alt=”The Mark Excell team outside the office”     width=”800″ height=”533″>

The img element is a void element, which means it has no closing tag and no content between tags. Everything it needs sits in its attributes. The src attribute points to the image file, the alt attribute describes it, and width and height state its dimensions.

Alt Text

The alt attribute is a short text description of what the image shows. Screen readers read it aloud, it displays if the image fails to load, and search engines use it to understand what the image is about.

  • Describe the image’s content and purpose in a short, natural sentence, not a string of keywords
  • Include text that appears inside the image, such as a sign or a button label, because that information would otherwise be lost
  • Leave the alt attribute empty, alt=””, for purely decorative images, which tells assistive technology to skip them
  • Never leave the attribute out altogether, since a screen reader may then read the file name aloud instead

<!– Weak –><img src=”img1234.jpg” alt=”image”><!– Better –><img src=”img1234.jpg” alt=”Bakery owner placing fresh loaves on a wooden counter”>

Width and Height

Stating an image’s width and height in the HTML lets the browser reserve the right amount of space before the file has downloaded. Without them, the page can jump around as images load and push text out of the way, which is the kind of layout shift that Core Web Vitals measures.

The values are the image’s natural pixel dimensions. CSS can still make the image scale to fit its container, so the two work together.

img {  max-width: 100%;  height: auto;}

Responsive Images with srcset and sizes

<img src=”/images/hero-800.jpg”     srcset=”/images/hero-400.jpg 400w,             /images/hero-800.jpg 800w,             /images/hero-1600.jpg 1600w”     sizes=”(min-width: 800px) 800px, 100vw”     alt=”A tidy home office with a laptop and notebook”     width=”800″ height=”533″>

A phone does not need the same file as a large desktop monitor. The srcset attribute offers the browser a menu of the same image at several widths, and sizes tells it how wide the image will appear on screen. The browser then picks the most suitable file, which can save a great deal of data on small screens.

The picture Element

<picture>  <source srcset=”/images/hero.avif” type=”image/avif”>  <source srcset=”/images/hero.webp” type=”image/webp”>  <img src=”/images/hero.jpg”       alt=”A tidy home office with a laptop and notebook”       width=”800″ height=”533″></picture>

The picture element lets you offer different file formats, or entirely different crops of an image for different screens. The browser works through the sources in order and uses the first one it supports, falling back to the plain img at the end. Modern formats such as WebP and AVIF typically produce much smaller files than JPEG at similar quality.

Lazy Loading

<img src=”/images/gallery-5.jpg”     alt=”Finished kitchen with oak worktops”     width=”800″ height=”533″     loading=”lazy”>

The loading attribute set to lazy tells the browser not to download an image until the visitor is close to scrolling to it. For pages with many images, this can noticeably reduce the initial load. It should not be used on the main image at the top of the page. That image is usually the largest visible element, and delaying it makes the page feel slower.

Figure and Figcaption

<figure>  <img src=”/images/before-after.jpg”       alt=”A garden before and after landscaping”       width=”800″ height=”533″>  <figcaption>The garden before and after the project.</figcaption></figure>

When an image has a caption, wrapping both in a figure element links them in a way machines can understand. The figcaption is the visible caption. It is not a substitute for alt text, since the two serve different purposes. The caption is for everyone who can see the image, while the alt text is for those who cannot.

Why Images Genuinely Matter for SEO and Speed

  • Large, uncompressed images are among the most common causes of slow pages, which affects both visitors and search performance
  • Descriptive alt text improves accessibility and helps images appear in image search
  • Declared dimensions prevent layout shifts, which helps the Core Web Vitals scores Google reports
  • Meaningful file names, such as oak-kitchen-worktop.jpg, give search engines a little extra context compared with IMG_4821.jpg
  • Images can bring traffic of their own through image search, particularly for visual topics such as food, design and products

Images in WordPress

WordPress handles a good deal of this automatically. It generates several sizes of each uploaded image, includes a srcset so browsers can choose the right one, and adds width and height attributes. Recent versions also add lazy loading by default and take care not to delay the main image near the top of the page. You still need to add the alt text yourself in the media library or block settings, and to upload a sensibly sized original instead of a 6000-pixel-wide photo straight from a camera.

A Quick Image Checklist

☐  Write useful alt text for every meaningful image, and an empty alt for decorative ones

☐  State width and height so the page does not jump while loading

☐  Resize and compress images before uploading, and consider WebP or AVIF

☐  Use srcset or a theme that provides it, so phones get smaller files

☐  Use loading=”lazy” for images below the fold, but not the main image at the top

☐  Give files descriptive names rather than camera defaults

☐  Check page speed reports for oversized images, and fix the biggest first

Frequently Asked Questions

Does alt text help SEO?

Yes, modestly. It helps search engines understand the image, supports image search, and is a core accessibility feature. Write it for someone who cannot see the image first, and the SEO benefit follows.

What is the best image format for websites?

It depends on the image. WebP and AVIF generally give the smallest files for photos at good quality, JPEG remains widely supported, PNG suits graphics needing transparency, and SVG is ideal for logos and simple illustrations because it scales without losing sharpness.

How big should my website images be?

As small as they can be while still looking sharp at the size they are displayed. A photo shown 800 pixels wide does not need to be 4000 pixels wide. Compress it as well, since many images can lose a large amount of file size with no visible difference.

Should every image be lazy loaded?

No. Images below the visible part of the page benefit from lazy loading, but the main image at the top should load straight away, because delaying it hurts how quickly the page appears to load.

Do I need to add alt text to decorative images?

Add an empty alt attribute. That tells screen readers to skip the image rather than read out a file name. Leaving the attribute out altogether is the mistake to avoid.

Wondering Whether Your Images Are Slowing You Down?

If you would like a second opinion on your site’s images and what they may be costing you in speed and visibility, get in touch for a plain conversation with no obligation and no sales pitch.

Keep reading

Further reading

Will AI replace SEO?

Will AI replace SEO? It is a question being asked with increasing urgency across the industry, and the honest answer requires separating two things that are often conflated: whether AI is changing how search works, and whether AI is making the discipline of search optimisation obsolete. The first is clearly true. AI has already significantly […]

15 July 2026 · 9 min read

How SEO Works in 2026

Every year brings a fresh wave of claims that SEO has been rewritten from scratch. AI Overviews, AI Mode, answer engines and a pile of new acronyms have made 2026 feel especially unsettled, and it is fair to wonder what actually still applies. The reassuring answer is that the foundations are largely the same. The […]

9 October 2026 · 6 min read