What is a Fallback Image?

A fallback image is the picture shown when the preferred one cannot be: because the file is missing, the format is not supported, or a video has not loaded yet.

How Fallback Images work

There are three common cases. For newer formats, the <picture> element lists options such as AVIF and WebP, and the browser falls back to the plain <img> inside it when it supports none of them. For missing files, an error handler on the <img> can swap in a placeholder. For video, the poster attribute shows a still image until playback starts.

Key facts

  1. <picture><source srcset="photo.avif" type="image/avif"><img src="photo.jpg" alt="A red bicycle"></picture> serves AVIF where it is supported and JPEG everywhere else.
  2. In a JavaScript error handler, replace src only once. If the placeholder is missing too, the handler would otherwise loop forever.
  3. The alt text is a separate, last fallback: it is shown in place of an image that fails to load, and screen readers read it either way.

When Fallback Images matter

Add fallbacks wherever a broken image would hurt: user avatars, product photos, and video players before playback. Give the fallback the same dimensions as the real image so the layout does not shift.

Turn media knowledge into a working pipeline

Connect uploads, processing, AI, storage, and delivery through one declarative API — with the encoding stack, scaling, and format churn handled for you.

Try Transloadit for free