Skip to content

Alt text: the basics

This post talks about what alt text is, and how and when to use it.

It’s part of a series called Accessible Intentions, which is for people who want to do the right thing for accessibility, but aren’t sure how. For more context and definitions of some terms I use here, read my introduction to the Accessibility Intentions series.

Cheat sheet: Just tell me what to do

Whenever you publish an image online, there will be an associated alt text field somewhere in your CMS.

To make sure your site meets minimum standards for alt text, make sure every image on your site has a concise and unique description of your image in this field.

If it’s a detailed image, focus on the most relevant things to describe.

Why is it important to think about alt text?

People use images on websites for all kinds of different reasons. Sometimes it’s to show what the products for sale look like, or give guidance on how to do something. Sometimes they’re just adding some character to a website.

Images can be very important. Photos of other humans, in particular, can help website visitors connect with the people behind the site.

But not everyone can see images. In the UK, around 2 million people are sight impaired in some way, which is a bit less than 3 people in every 100. [Sight loss statistics – RNIB]

Many of these people use the internet using screen reading software. There’s more detail on screen readers and sight impairment in the introduction to this blog series.

Screen reading software reads out the alt text of images on a website. If there’s no alt text, or the alt text doesn’t make sense, a blind person has no idea what the image shows, or how important it is.

What does WCAG say about alt text?

Alt text is the very first thing covered in WCAG. It’s criteria 1.1.1, level A – the basic minimum standard.

“All non-text content…has a text alternative that serves the equivalent purpose”.

By ‘non-text content’ WCAG basically means images, video and audio. If you can truly get WCAG 1.1.1 right, you’re a long way down the road to having an accessible site.

Exceptions

The quote from the WCAG guidance I gave earlier is only part of the story. The fuller quote starts to bring in the nuance:

“All non-text content…has a text alternative that serves the equivalent purpose except for….”.

So what are these exceptions, and what do they really mean?

The two main, straightforward exceptions are for decorative elements and for images that have a function.

When it’s just decorative

This is the most common get-of-out-jail card for alt text. If an image is only there to look pretty, you can mark it as decorative and not need alt text. Screen readers ignore these images entirely. But what counts as ‘decorative’?

Theoretically, you could mark every image on your site as decorative, and an automated review would give you full points. But the people actually using your site will be missing out.

There’s constant debate on when something is considered decorative, and no single right answer. As a rule of thumb, pretty swirls and geometric shapes are decorative, but photographs probably aren’t. If a photo genuinely adds nothing to the page, you might want to choose a different one.

Note that people accessing alt text might still be able to see the image, just not well. If someone knows there’s an image there, but they aren’t being told anything about it, they’re likely to feel left out.

When it’s a button

If you have a tiny image that is there to help someone do something, it doesn’t need alt text.

For example, in many search bars, people need to select a picture of a magnifying glass to start their search. You don’t need alt text describing the magnifying glass. But you do need proper labels telling screen reader users what to do.

Where it gets complicated

Alt text is a cornerstone of accessible web content, but it’s full of nuance and complications. Here are a few of the most common ones.

How much detail should you include in alt text?

This is a really common question, and sadly has no single ‘right’ answer. Some organisations advise particular character limits, but there’s no consensus.

If you need a lot of alt text to describe what’s important in your image, you might need to replace your image. In particular, huge images with lots of text in them are just not a good idea.

Beyond that, there’s an element of choice. Some screen reader users appreciate rich detail. Others hate it.

My advice is to:

  • pick an approach and be consistent
  • aim for a similar length for all your alt text
  • make sure what you do say is meaningful and unique

Alt text and inclusivity

Alt text is often used to describe what someone looks like. This brings up lots of issues around inclusivity.

For example:

  • When and how do you describe gender, race, or age?
  • When and how do you mention a visible accessibility aid?
  • What about body size and shape?

This is too big an area to go into detail about here. Lots of others have written about this subject – I particularly like this video from Haben Girma about describing race.

The key thing is that it’s always important to think about inclusivity issues in your alt text. The easiest solution is often to ask people how they prefer to be described.

Graphs and charts

Sometimes you need to show a visual representation of data – like a graph or pie chart. This can really help people understand that data; particularly people with dyscalculia.

But these images have too much detail to describe in alt text.

The best solution is often to give the same information in text or table format. Keep the alt text simple, and clearly refer people to where they can find the information.

For example:

“A pie chart showing the data given in Table 4.”

Make sure ‘table 4’ is properly labelled, though. And you still need to consider the colours you use, for people who can see your chart.

Is that all?

Not remotely! The issue of how to use alt text is full of subtleties and side notes. I haven’t even talked about image descriptions. I haven’t mentioned CAPTCHAs and other tests. I’ll pass over to others for some of that detail.

In general though, alt text is only as complicated as your website. If your site is simple and straightforward, your alt text can be simple, too.

Free tools

There are a few different tools that can help you find missing alt text on your site. The WAVE browser plugin can highlight where alt text is missing, repeated or ‘suspicious’ on a particular page. I also find this images bookmarklet from Paul Adam to be a useful way to check image alt text.

To actually generate alt text, some people use AI tools. If you do this, check the text carefully to make sure it describes what you need. You also need to be careful about terms and conditions – some services will then use that image to train generative AI, which could be a breach of copyright.

Get in touch

If you have feedback on this post, need help with alt text, or need advice about anything to do with accessible and inclusive content, you can get in touch via email or social media.