This document is in beta. Help us by reporting issues via Github or email.

Back to the overview page

Text alternative for images

In a nutshell ...

Provide alternative text for images.
Make sure it conveys the same message.

Every image must ...

This is so that ...

On this page:

Example

On a page promoting a holiday resort, the purpose of this picture might be to convey that the resort is family friendly.

We’re family-friendly.

We’re family-friendly.
        

Example


Example

If a button's name is already included in text, the icon shouldn't be read out by screen readers.


  1. An img element with no alt attribute

    Example

    With the code below, screen readers would read out the image like this:
    "search underscore icon underscore jeo87668 underscore medium underscore 2x.png Search, button".

    
    
  2. Text alternative that does not serve the same purpose as the image

    Example 1

    The purpose of this magnifying glass icon is to convey a 'Search' functionality. So its alternative text should be 'Search', not 'Magnifying glass'.

                            
    

    Example 2

    This alt text describes what's on the image, but doesn't serve the same purpose as the image.

    A man, a woman and their son smiling.
                          
    A man, a woman and their son smiling.
                          
                      
  3. Text alternative that includes redundant words like 'image', 'icon', 'button' or 'select this to ...'

    • The type of the element (such as image or button) should not be included in the text alternative.

      An element's type is programmatically determined (based on the HTML element's tag name or `role` attribute) and announced by the screen reader.

    Example 1

    The alt text should not include 'button'.
    This would be read out by screen readers as "Play button, button".

    
    
                      

    Example 2

    This would be read out by screen readers as "Picture of a happy family, image".

    Picture of a happy family.
    
    Picture of a happy family.    
                      
  4. Using CSS background-image for images that are not purely decorative or redundant

    • Do not use a CSS `background-image` for images that convey purpose or information not already available in text.

    • CSS background images are not available to assistive technologies.

    • CSS background images may only used for:

      • decorative images
      • images that communicate information or functionality that's also described in text.

  5. Text alternative that is too verbose

    • Try to be succinct (50 characters max).

    • Verbose alternatives make content harder to listen to and understand for screen reader users.

More guidance

Sources and copyright

General guidance and examples

Images

  • Search icon: Copyright Rohith M S from the Noun Project, licensed under Creative Commons license
  • Pay icon: Copyright Alena Artemova from the Noun Project, licensed under Creative Commons license