IMAGES · IN ENGLISH

Website images: alt text, formats and lazy loading

A short guide for editors and developers: text alternatives, file formats, dimensions and lazy loading, without layout jumps or needless delays.

Images make a page easier to understand, and they are also where quiet mistakes pile up: a photo with no description, a logo that weighs more than all the text on the page, a banner that makes the text jump while it loads. Most of these choices are made by whoever publishes the content, not by a developer. Here is what to check before you publish, and which parts can be checked automatically.

Alt text is for people, not for search

The alt attribute is the text alternative for an image. Screen readers read it out, and browsers show it when the file fails to load. So the first question is not which words to put in it, but what someone loses if they cannot see the picture. The W3C WAI decision tree answers by the role the image plays:

  • An informative photo or diagram. Briefly convey the meaning it adds. An illustrative example for a café: not "photo" but "Dining room with twenty seats and windows onto the square".
  • A decorative image such as a background texture, a divider, or an illustration that repeats the text next to it. Use an empty alt="" so screen readers skip it.
  • An image inside a link or button. Describe where the link goes or what the action does: "Basket", not "cart icon".
  • An image of text. If that text appears nowhere else on the page, put it in the alt.
  • A complex chart or graph. The details will not fit in alt; give the same information in nearby text or a table.

Google also asks for useful, information-rich descriptions and warns that filling alt attributes with keywords is keyword stuffing and may be treated as spam. Its own example ranks "Dalmatian puppy playing fetch" above a bare "puppy".

A useful test for editors: read the page aloud, replacing each image with its alt. If it still reads naturally and nothing important is missing, the alt text works.

How search finds your images

Google finds images in the src attribute of <img> elements, and it does not index images set as CSS backgrounds. A product photo you want in image search should therefore be an <img>, not the background of a block.

Two small things are easy to get right when you upload the file:

  • A short, descriptive file name. Google's example: my-new-black-kitten.jpg rather than IMG00023.JPG.
  • A file extension that matches the real file type. Google Search supports BMP, GIF, JPEG, PNG, WebP, SVG and AVIF images.

A page can offer several versions of a file for different screens through the srcset attribute or the <picture> element. Google recommends always giving a fallback address in src.

Format: photos, graphics and icons

MDN's guide gives a simple starting rule: for raster images, prefer WebP or AVIF, which generally compress better than PNG, JPEG and GIF. The kind of image matters too:

What the image shows What to use Fallback
A photograph WebP or AVIF with lossy compression JPEG
A screenshot, a diagram with text, a raster logo Lossless compression, because blurred edges around text are very visible PNG
A logo, icon or diagram that must stay sharp at any size SVG WebP or PNG
An animation WebP, AVIF or APNG instead of GIF —

If the site must support browsers without the newer formats, MDN suggests the <picture> element: a few <source> entries in different formats, with an <img> holding the most compatible version at the end. Two or three versions are usually enough.

No format will save a photo uploaded straight from a camera at full size into a small block. Resize the image to the size it is shown at first, then choose the format.

It helps to agree once, as a team, who resizes photos, which format they are uploaded in and who checks the alt. Then the result does not depend on who happens to publish today.

Width and height: reserve the space in advance

web.dev recommends adding width and height attributes to all <img> tags. Without them the browser does not know how much room to leave until the file arrives. When the image finally appears, the text below it jumps down: the reader loses their line or taps the wrong button. That is the layout shift the CLS metric measures.

The attributes tell the browser the image's proportions; your styles can still let it scale with the screen width. They matter even more for lazy-loaded images: web.dev explains that without dimensions such images are treated as 0×0 pixels, so a gallery may end up loading every file at once.

For more on CLS and the other speed metrics, see our plain-words guide to Core Web Vitals.

Lazy loading: only below the first screen

The loading="lazy" attribute delays an image until the reader scrolls close to it. On a long article or a gallery that saves data and time. web.dev draws the line clearly: use loading="lazy" only for images outside the initial viewport, and do not lazy-load images that are likely to be visible when the page loads, especially the largest image on the first screen.

The hero banner, the photo on a product page and the first image in an article should load normally. If your CMS theme or a plugin lazy-loads every image, check what the first large image in the template gets. The simplest way is to view the page source in your browser, find that image and make sure it has no loading="lazy".

There is no risk for older browsers: web.dev notes that browsers without support simply ignore the attribute.

What FluxRadar checks, and what needs a person

When it audits a site, FluxRadar reports:

  • Images without an alt attribute. The finding appears under both SEO and accessibility. An empty alt="" is not treated as an error, since it is the normal way to mark a decorative image.
  • Broken images or media. A file is reported as broken only when the crawl actually requested it and got a 4xx or 5xx error, no response, or an HTML page instead of an image. A file that was not checked is never called broken.

Whether the alt describes the image well, or whether an image really is decorative, is a judgement only a person can make. FluxRadar has no separate checks for file format, width and height, or loading="lazy", so check those by hand:

  • every meaningful image has an alt that carries its meaning;
  • decorative images have an empty alt;
  • the file is resized to its display size and the format suits the image;
  • each <img> has width and height;
  • images on the first screen do not use loading="lazy".

Sources and verification

External guidance checked on November 30, 2026. The examples are illustrative: they do not describe client results and do not promise search positions.

Check your site · Practical guides (in Ukrainian) · Articles for site owners