HTML <img> alt Attribute

The alt attribute on an <img> tag specifies alternative text for the image.

This alternative text only displays when the image cannot be loaded.

This value can also help improve SEO.



An <img> element with an alt attribute. The image is loaded without error, therefore the alternative text does not display.

Van Gogh, Self-portrait
<img src="/img/html/vangogh.jpg" 
     alt="Van Gogh, Self-portrait">

In this example the image name has a typo and the file cannot be found.
The alt text displays next to a broken image icon.

Van Gogh, Self-portrait
<img src="/img/html/vangooi.jpg" 
     alt="Van Gogh, Self-portrait">

Using alt

The alternative text displays only when the image is not found, or cannot be loaded.

Alternative text is also used by screen readers and SEO to describe the image.

Tip: Use the alt attribute on all your images.


<img alt="text" />



Value Description
text Alternative text for an image element.

Browser support

Here is when alt support started for each browser:

1.0 Sep 2008
1.0 Sep 2002
1.0 Aug 1995
1.0 Jan 2006
1.0 Jan 2003

You may also like

 Back to <img>

Last updated on Sep 30, 2023