How long should alt text be, and do icons need it?
Alt text is the words a screen reader speaks in place of an image, and the words a browser shows when the image fails to load. Two questions come up again and again: how long it should be, and whether every icon, divider and background photo needs a description. Getting either wrong makes pages harder to use. Text that is too long buries the point, text that is missing makes some screen readers read out a file name, and icons with descriptions repeat what the words beside them already say. This guide gives you a working length, a simple test for deciding what each image needs, the correct markup for icons, icon-only buttons, logos, charts and linked images, and a routine for checking the whole site.
What alt text is for, and why length matters
The alt attribute on an <img> gives the image a text alternative. A screen reader reads it aloud when it reaches the image, a browser shows it in place of a broken image, and search engines use it, along with the surrounding text, to understand what the image shows. WCAG success criterion 1.1.1 (Non-text Content) asks that every image that carries meaning has a text alternative serving the same purpose, and that purely decorative images are marked so assistive technology can ignore them.
No standard sets a maximum length. HTML does not limit the attribute, and current screen readers read the whole value. The often-quoted figure of 125 characters is a working habit from older advice, not a rule. It is still a useful target, because alt text is heard in one go: a listener cannot skim it or jump back to the important part, and most screen readers do not let the user pause inside it as easily as inside normal text.
| Image type | Typical alt length | What it should say |
|---|---|---|
| Product or service photo | 5 to 15 words | The item and the detail that matters for choosing it |
| Logo linking to the home page | 2 to 5 words | The organisation name and home |
| Icon beside matching text | Empty | Nothing; the text already says it |
| Icon-only button or link | 1 to 4 words | The action or destination |
| Chart or diagram | One sentence | The main finding, with the data in text nearby |
| Decorative flourish or divider | Empty | Nothing |
If your description needs more than about two sentences, the image probably holds information that belongs in the page itself, in a caption or in a paragraph that everyone can read.
Deciding what each image needs
The right alt text depends on what the image does in its place on the page, not on what the picture contains. The same photo of a red bicycle might need the model name on a shop page, the words Hire a bike on a button, and nothing at all as a background behind a heading. Work through these questions in order and stop at the first that fits:
- Is the image the only content of a link or button? Then the alt text is the name of that link or button. Describe the destination or action, such as
Download the 2026 price list (PDF), not the picture. - Does it contain text? If the text matters, repeat it in the alt. If the same words also appear as real text next to it, the image can be silent.
- Does it add information the page needs? Then describe that information briefly. For a chart, give the conclusion and put the figures in a table or paragraph.
- Is it purely decorative, or does it repeat nearby text? Then use
alt="".
A helpful check is to imagine phoning a customer and reading the page to them. Whatever you would say when you reached the image is a good alt text. If you would say nothing, the alt should be empty.
Empty alt is not the same as missing alt
alt="" is a deliberate signal that the image is decorative. Screen readers skip it entirely. When the attribute is left out, many screen readers fall back to announcing the file name or the address, so a listener hears something like image, I M G underscore 2041 dot jpg. Audit tools flag missing alt for this reason. They should not flag a correctly empty alt, and if they do, the warning is a false positive rather than a reason to add a description.
alt=" " with a space. Some tools and screen readers treat a space as a non-empty value. Use two quotation marks with nothing between them.Icons: silent, labelled or named on the control
Icons cause more confusion than any other image type because the same icon can need three different treatments. What matters is whether visible text already does the job.
Icon beside text that says the same thing
A phone icon next to the words Call us, a basket icon next to Basket, or a tick next to each item in a features list add nothing for a screen reader user. Hide them, otherwise the user hears phone, Call us or, worse, a file name before every list item.
<!-- Image file -->
<a href="tel:+441632960961"><img src="/icons/phone.svg" alt="" width="16" height="16"> Call us</a>
<!-- Inline SVG -->
<a href="/basket"><svg aria-hidden="true" focusable="false" width="16" height="16">...</svg> Basket</a>
<!-- Icon font -->
<button><i class="icon-print" aria-hidden="true"></i> Print</button>
Icon fonts deserve special care. The glyph is often a private-use character that some screen readers announce as an odd symbol or not at all, so always add aria-hidden="true" to the element that holds it.
Icon-only buttons and links
A magnifying glass that opens search, a cross that closes a dialog or a hamburger that opens the menu has no visible text, so the control needs an accessible name. Put the name on the control itself and hide the icon.
<!-- aria-label on the button -->
<button type="submit" aria-label="Search">
<svg aria-hidden="true" focusable="false" width="20" height="20">...</svg>
</button>
<!-- Visually hidden text, which also translates with the page -->
<button type="button" class="menu-toggle">
<svg aria-hidden="true" focusable="false">...</svg>
<span class="visually-hidden">Open menu</span>
</button>
<!-- Image file inside a link: the alt is the link name -->
<a href="https://www.linkedin.com/company/example"><img src="/icons/linkedin.svg" alt="Our LinkedIn page"></a>
Visually hidden text uses the usual clip pattern, so it is read by assistive technology but takes up no space:
.visually-hidden {
position: absolute; width: 1px; height: 1px;
padding: 0; margin: -1px; overflow: hidden;
clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
role="img" and an aria-label, or a <title> as its first child. Our ARIA labels guide covers the naming rules in more depth.Worked examples for common images
These examples come from typical small business pages. Each shows the image, what it does on the page and the markup that fits.
| Image | Role on the page | Alt text |
|---|---|---|
| Oak table on a product page | Shows what is for sale | Oak dining table with six matching chairs |
| Company logo in the header, linking home | Link to the home page | AI Web Page SEO home |
| Same logo in the footer, not linked | Branding only, name in text beside it | Empty |
| Bar chart of yearly sales | Supports a claim in the text | Bar chart: sales doubled from 2024 to 2026 |
| Team photo on the About page | Shows who the customer will meet | The four members of the support team outside the Leeds office |
| Abstract swirl behind a heading | Decoration | Empty |
| Stock photo of a handshake | Mood only | Empty |
| Scanned certificate | Proof of a qualification | Gas Safe registration certificate, number 123456, valid to 2027 |
The chart deserves a closer look. The alt gives the one fact a listener needs to follow the argument. The detailed figures go in a short table or a paragraph under the chart, where everyone, including people who struggle to read small chart labels, can use them:
<figure>
<img src="/images/sales-2024-2026.webp" width="800" height="450"
alt="Bar chart: sales doubled from 2024 to 2026">
<figcaption>Sales were 410 orders in 2024, 590 in 2025 and 830 in 2026.</figcaption>
</figure>
When a caption already describes the image fully, keep the alt short or empty so the listener does not hear the same sentence twice. More on images with visible captions is in the guide to alt text not showing on hover.
How to check alt text across a page
Automated tests can find missing alt attributes, but they cannot tell whether the text is right. Use a quick script to list every image and its alt, then judge each one with the questions above. Paste this into the browser console on any page:
console.table([...document.images].map(img => ({
src: img.currentSrc.split('/').pop(),
alt: img.hasAttribute('alt') ? img.alt : '(missing)',
length: img.alt.length,
inLink: !!img.closest('a, button'),
hidden: img.closest('[aria-hidden="true"]') ? 'yes' : ''
})));
Look for four patterns in the table: (missing) values, which need fixing first; very long values over about 150 characters; values that are file names or start with Image of; and images inside links where the alt is empty, which leaves the link with no name at all.
For inline SVG and icon fonts, open DevTools, select the button or link, and read the Computed name in the Accessibility pane. If the name is empty, or reads as a stray symbol, the control needs a label. Lighthouse and similar checkers report this as buttons or links that do not have an accessible name.
Listen once
Turn on a screen reader for five minutes. NVDA is free on Windows, VoiceOver is built into macOS and iOS (Command and F5 on a Mac), and TalkBack is built into Android. Move through the page with the arrow keys or by swiping. You will quickly hear decorative images that should be silent and icon buttons that have no name. Our accessibility guide explains the wider checks worth running at the same time.
Platform notes
- WordPress. The Alternative Text field in the media library sets a default, but the block editor stores alt per image block, so changing the library value does not update images already placed in posts. To make an image decorative, leave the field empty; WordPress then outputs
alt="". Some themes and page builders print icons as images without any alt. See accessibility fixes for WordPress. - Shopify. Product media has an alt field under each image. Theme code using the
image_tagfilter outputs the stored alt, and themes often fall back to the product title when it is empty, which repeats the heading beside it. Theme icons are usually inline SVG snippets; check they carryaria-hidden="true". See accessibility fixes for Shopify. - React and Next.js. The
altprop is required onnext/image, and an empty string is accepted for decorative images. Icon libraries such as Lucide and Heroicons render SVG; passaria-hiddenwhen the icon sits beside text, and putaria-labelon the surrounding button when it does not. - Page builders. Icon widgets in Elementor, Divi and similar tools often add their own markup. Check the rendered HTML rather than the widget settings.
The fix, step by step
Step 1
List every image and its alt
Open the page, paste the console script from the audit section into DevTools and read the table it prints. Note each image with a missing alt, a file name as its alt, a value over about 150 characters, or an empty alt inside a link. Repeat for each page template, such as the home page, a product page, a blog post and the contact page. This list becomes your working checklist for the rest of the fix.
Step 2
Sort each image by its role
For every image on the list, decide its role: the only content of a link or button, an image containing text, an informative image, or decoration. Write the role next to it. Do not start writing descriptions until you have done this, because the role decides the answer. A logo can be a link to home on one page and pure branding on another, and a photo can be informative or purely mood-setting.
Step 3
Write short alt text for informative images
For product photos, team photos, certificates and similar images, write a phrase or sentence that gives the information the image adds to the page. Name the item and the detail that matters, and stop. Most will land between five and fifteen words. Do not begin with Image of or Picture of. Check each one by reading the surrounding paragraph aloud with the alt in place of the image and listening for gaps or repetition.
Step 4
Name linked images and icon-only controls
Where an image or icon is the only content of a link or button, set its name to the destination or action, such as Search, Close or Download the price list. Use alt on an image file, or aria-label or visually hidden text on the button for inline SVG and icon fonts. Then select the control in the DevTools Accessibility pane and confirm the Computed name shows the words you intended.
Step 5
Silence decorative images and duplicate icons
Set alt="" on decorative images, stock mood photos and icons that sit beside words saying the same thing. For inline SVG and icon fonts add aria-hidden="true", and focusable="false" on SVG for older browsers. Make sure the empty alt has no space inside it. Rerun the console script and confirm these images now show an empty value rather than missing, and that none of them is inside a link without other text.
Step 6
Handle charts and images of text
For charts and diagrams, write one sentence giving the main finding as the alt and put the figures in a caption, table or paragraph that everyone can read. For images containing words, such as promotional banners, copy the important words into the alt, or replace the image with real text over a background. Check the page by reading only the text and the alt values and confirming nothing essential is lost.
Step 7
Fix the source in your CMS or code
Make the changes where they will last. In WordPress edit the alt on each image block, not only in the media library. In Shopify update the media alt fields and check the theme fallback. In React or other component code, change the shared icon and image components so icons are hidden by default and require a label when used alone. Clear any page cache and reload the live page.
Step 8
Test with a screen reader and an audit
Run a Lighthouse accessibility audit and confirm there are no warnings for images without alt or buttons and links without names. Then turn on NVDA, VoiceOver or TalkBack and move through the page. You should hear clear names for every control, short descriptions for informative images, and nothing at all for decoration. Anything that sounds repeated or confusing goes back to the earlier steps for another pass.
Edge cases worth knowing
- Images of text. A banner that says 20% off this weekend must carry those words in the alt, because a screen reader cannot read pixels. Better still, use real text over a background image.
- Complex diagrams. A floor plan or process diagram needs a short alt plus a longer description on the page or a linked page. Point to it in the alt, for example
Floor plan of the ground floor, described below. - Several images in one link. If a product card wraps a photo and the product name in one link, make the photo silent. Otherwise the link name repeats.
- Background images in CSS. These have no alt and are ignored by assistive technology. That suits decoration, but never put meaningful content in a CSS background.
- Keyword stuffing. Alt text written for search engines, such as a list of service and town names, makes pages tiresome to listen to, and Google warns it can cause a site to be seen as spam. Describe the image honestly instead.
- Language. Alt text is read in the language of the page. On multilingual sites translate it, or a French page will read English alt with French pronunciation.
Keeping alt text right
- Write a one-page alt text rule for everyone who uploads images: describe the purpose, keep it short, leave decoration empty, and never use the file name.
- Build icons into components that hide them by default and require a label prop when the icon is used on its own. That way a developer cannot ship an unnamed icon button by accident.
- Run an automated accessibility check on each template after changes, and review new pages by reading the console table above.
- Recheck after theme or plugin updates, which often change how icons and logos are printed.
The broader rules on writing descriptions are in the alt text guide, and the treatment of purely visual images is covered in fixing decorative images.
1. Is there a character limit for alt text?
No, there is no official character limit for alt text in HTML or in WCAG, and modern screen readers read the full value. The figure of 125 characters comes from older advice and works well as a habit rather than a rule. Short alt text is easier to listen to, because a screen reader user hears it in one go and cannot skim it. If you need more than a couple of sentences, put the detail in a caption or in the page text and keep the alt to the main point.
2. Do icons need alt text?
Icons need alt text only when they carry meaning that is not already in visible text. An icon beside a word that says the same thing, such as a phone icon beside Call us, should be hidden with an empty alt or aria-hidden so the screen reader does not repeat itself. An icon that is the only content of a button or link, such as a magnifying glass for search, needs an accessible name on that control, given through alt, aria-label or visually hidden text.
3. What is the difference between empty alt and no alt attribute?
An empty alt attribute tells assistive technology the image is decorative and should be skipped, while a missing alt attribute leaves the screen reader to guess. When alt is missing, many screen readers announce the file name or image address instead, which is confusing and sometimes long. Audit tools flag missing alt for this reason. An empty alt written as two quotation marks with nothing between them is a correct, deliberate choice for decoration and should not be treated as an error.
4. Should alt text include keywords for SEO?
Alt text should describe the image honestly, and a relevant keyword is fine only where it is the natural way to describe it. Google uses alt text along with the page content to understand images, so an accurate description helps image search. Lists of keywords, town names or services make the page tiresome for screen reader users, and Google's guidance warns against keyword stuffing in alt attributes. Write for the listener first; that is also what serves search engines best.
5. What alt text should a logo have?
A logo that links to the home page should have alt text that names the organisation and the destination, such as the business name followed by home. That alt becomes the name of the link, so a screen reader user knows where it goes. A logo that is not a link and sits beside the business name in text can have an empty alt, because the name is already there. Avoid writing the word logo unless the visual identity itself is the subject of the page.
6. How do I add alt text to an SVG icon?
An SVG image file in an img tag takes an alt attribute in the normal way. For inline SVG, add aria-hidden set to true when the icon is decorative or sits beside text. When the inline SVG carries meaning on its own, give it role set to img with an aria-label, or a title element as its first child. If the SVG is inside a button or link with no other text, put the label on the button or link instead and hide the SVG itself.
7. Do decorative images need alt text for accessibility audits?
Decorative images need an alt attribute, but its value should be empty, which passes accessibility audits. WCAG asks that decoration is implemented so assistive technology can ignore it, and an empty alt does exactly that. Adding a description just to clear a warning makes the page worse for screen reader users, who then hear pointless descriptions of dividers and background shapes. If an audit tool flags a correctly empty alt as a problem, treat it as a false positive rather than changing your markup.
The accessibility audit lists images with missing alt text, links and buttons without an accessible name and icons that screen readers will announce, so you can fix each one in order.
Open Accessibility Fixes โ