HTML alt Attribute


The HTML alt attribute is used within an <img> tag to provide alternative text for an image. This text serves several important purposes: it describes the content of the image for users who are unable to see it, such as visually impaired users relying on screen readers, and it can be displayed in place of the image in browsers if the image file is not loaded. Additionally, the alt attribute enhances web accessibility, making the content of images available to users regardless of their ability to visually perceive them. It also plays a role in search engine optimization (SEO), as it provides search engines with context about the image content, which can help in indexing and ranking the website. Properly describing an image with the alt attribute involves succinctly conveying the image's content or function, making the web more inclusive and informative.


<tagname alt="text">


  • textText to describe the alternative text

Applies To

The alt attribute can be used on the following html elements.


<img src="images/broken.jpg" alt="Image of Sunset">
<p>Note: The image will not load so that you can see the alt attribute in action.</p>

Browser Support

The following table will show you the current browser support for the HTML alt Attribute.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 25th March 2024