Writing good ALT text

Contributed by Simon Willison

One of the first things anyone learns about accessible web design is the importance of the alt attribute on images. If you are using XHTML, image tags without alt attributes won't even validate, so ensuring this information is provided becomes even more important. Writing alt text is easy, but writing it well enough for it to be a help rather than a hindrance can take some thought.

ALT means ALTernative

The alt attribute is meant as an alternative to the image; if the image is displayed, the alt attribute should not be (unfortunately Internet Explorer gets this wrong by displaying alt attributes as a tooltip, a function better served by the title attribute). When writing alt text, it is important to ask yourself what information the image is conveying.

For decorative images, leave it blank

Most sites contain a large number of images which are there for purely decorative purposes: things like spacer gifs, images forming the corner of a pretty drop shadow effect, floral patterns attached to item headers. All of these should have their alt attributes left empty. They add no extra information to the content, so as far as a screen reader or text browser is concerned they do not exist.

If an image contains text, replicate the text in full

Images containing text are frequently used when a non-standard typeface is required by a site design. There is absolutely nothing wrong with this technique from an accessibility point of view, provided the alt text exactly replicates the text on the image. There are no exceptions to this rule: if an image contains text, the alt text must be the same. This is particularly important when images are used for navigation elements that also act as links.

For charts and graphs, try to summarise the trend

Charts and graphs are one of the harder image types to make accessible. The phrase "a picture speaks a thousand words" definitely applies here. Often though, a chart will be being used to highlight a specific trend. The alt text can therefore be used to summarise that trend, for example "unemployment rates rose from 5% in January to 7% in March". The longdesc attribute may become useful here (more on that below).

For custom bullets, use CSS

If an image is being used as a custom bullet point for a list, consider using CSS instead. CSS provides an easy way of replacing the bullet points in an HTML list with a custom image, and doing so will reduce the size of your markup while making things more accessible as well. If for some reason this is not an option (you need to serve up a pixel-perfect design to users of outdated browsers such as Netscape 4) then it is acceptable to use a single asterisk instead: this will at least serve text browsers such as Lynx

For everything else, be imaginative!

The above advice covers the most common easy cases; for images that are there for a purpose and are not covered above you really need to use your imagination. What information is the image conveying? For example, a photograph of your Uncle may be served by "My Uncle, standing in our living room, holding our black and white cat". Writing suitable alt attributes for photographs is particularly difficult. There are no hard and fast guidelines, so it is up to you to make the best of a tricky situation.

Test in Lynx

The Lynx text only browser is a great tool for testing whether or not your alt attributes are effective. It can be downloaded from the Lynx site, but there is also an online tool which emulates your site as displayed by Lynx without the need to install any additional software.

The longdesc attribute

Less well known than the alt attribute is the longdesc attribute, an optional extra for the image tag which can be used to point to the URL of a full description of an image. Support for longdesc in modern user agents is almost non-existent, but that may well change in the future. Depending on the information conveyed by an image, you may be well served to write up a separate long description and link to it using this attribute. One clever technique (demonstrated by Mark Pilgrim in his 100 series) is to include the description on a page below a photgraph, and use the longdesc attribute to link to that part of the page using a fragment identifier.

Further Reading

  • Joe Clark writes extensively about making images more accessible in his book, "Building Accessible Websites".
  • Ian Hickson has an extensive essay on picking the correct alt attribute.
  • Dive Into Accessibility covers alt text usage.


Comments

IE will use the title attribute for tooltips, however, which means that you can bring it inline with other browsers. If you don't want tooltip text, the answer is to use a blank title attribute [title=""] which keeps the alt text for its intended purpose.

Auto Hifi | Tue Apr 21 2009

Probably I had hoped to find the answer to my querie, but haven't so far! However, you may be able to help!(See my site)I want to display text details about my artwork without cluttering the pages with text.

Essay Writing | Sun Apr 19 2009

The Alt tag is deive, relatively short and put a few Keywords into the Alt Tag, hence if you offer Computer Repairs in Reading Berkshire, and your picture shows a computer being repaired in Reading Berkshire, then place the Words Computer Being Repaired in Reading Berkshire into the alt tag

Essay Writing | Sun Apr 19 2009

Thank you for sharing very nice information. No doubt ALT tag is very important. This can be found useful when browsers somehow can't download your images.

Office Templates | Wed Apr 15 2009

Google's official line, and surely the accessibility approach? with regards to if the image is a hyperlink also then this is a very positive thing as yes, the alt text then becomes the link anchor text and that is just about the most powerfully weighted thing on the page as far as engines are concerned. apologies if my comment was perceived negatively it wasnt meant to be so

water damage atlanta | Wed Apr 15 2009

Most web developers forget command line browsers like Lynx. It's also good for Googlebots. You'll be amazed to see how much alts help it organize your site meaningfully.

water damage miami | Wed Apr 15 2009

IE will use the title attribute for tooltips, however, which means that you can bring it inline with other browsers. If you don't want tooltip text, the answer is to use a blank title attribute [title=""] which keeps the alt text for its intended purpose.

water damage miami | Wed Apr 15 2009

An excellent synopsis, i agree that Alt tags are essential in any big website that is largely image based. As bandwidth increases, there is a lot more scope for images on websites and this makes alt tags even more important

stag weekends | Mon Apr 13 2009

these tags can bring the right audience based on the tags they search for. vice versa when you want to bring audience via image that's been targeted by image search engines. Hope that helps.

government grants | Sun Apr 12 2009

Good steps which are very useful in my writings.Holding our black and white cat". Writing suitable alt attributes for photographs is particularly difficult. There are no hard and fast guidelines, so it is up to you to make the best of a tricky situation.

Custom Dissertation | Fri Apr 10 2009

It seems to me to make sense to name a search form "SearchForm" or a subion form "SubionForm". Content management systems and authoring tools have a tendency, in my experience, to insert their own text like "f_box" or "f_r_t012" which is hard enough for developers to follow, let alone a site visitor.

rezv | Thu Apr 09 2009

I would suggest that, if your alt attributes contain information that could be spread across 2 or 3 lines, you are probably putting more information in them than is necessary or sensible. I'd suggest that any information that is extraneous to conveying the essentials/function of an image should go in a title attribute.

cooking games | Thu Apr 09 2009

I feel this article will change minds of many. Many people say that the well you do it, the better it is. How come in the first paragraph says that when you try to make a picture just right, it will stop your thoughts. It is suppose to help your thoghts. Maybe I'm just wrong but some lessons of making a web doesn't make since.

China Tours | Wed Apr 08 2009

We have so many images on our site and the people who load them are fully trained to insert alt text (although sometimes this gets missed). We do it primarily so that visually impaired people can see what we are talking about. I was once shown a demo of what a site would look like without the images and without alt text and it made no sense at all

Toplist | Wed Apr 01 2009

Writing good ALT text is critical for a website accessibility. This is good article and thanks for sharing such an informative article. To answer a question Mr. XRumer asked, I believe it is not a good practice to use special characters in ALT tag however this can be used from syntax point of view.

FlyerTemplates | Wed Mar 25 2009

I found this article to be very informative. Thanks for sharing, but i have one question: what about punctuation and special characters in alt. and title deions? can you use any of the following? @ | , . ?

XRumer | Mon Mar 23 2009

Thank you for sharing such a nice information. You have introduced me a wonderful testing tool (Lynx). I have never heard of it and now downloading it to always test my sites with it.

Sonia | Sat Mar 21 2009

This is a great article however for the CSS point, I think it is better to use asterisk than a CSS based bullet format. The reason is quite simple as browsers like Lynx (text based), can't render them correctly. I also remember reading another article on your site where author was discouraging use of CSS for the accessibility of websites.

Romee | Fri Mar 13 2009

As mentioned in the article, Internet Explorer incorrectly uses the ALT attribute as a tooltip. IE will use the title attribute for tooltips, however, which means that you can bring it inline with other browsers. If you don't want tooltip text, the answer is to use a blank title attribute [title=""] which keeps the alt text for its intended purpose. This brings me on to a similar point - when the article says 'for decorative images leave [alt text] blank' that means write: alt="" in the markup. Omitting the alt attribute altogether is considered invalid markup and may cause problems for assistive technology.

Smooth Pixel | Tue Feb 17 2009

You can also use alt attributes for people with sight disabilities who use assistive technology.

Trip insurance | Fri Feb 06 2009

Jeff, think of alt tags as deion of an image. For example an image of a group of people in the room could be described as "businessmen having a teleconference" or something like that.. so if you were promoting an image then these tags can bring the right audience based on the tags they search for. vice versa when you want to bring audience via image that's been targeted by image search engines. Hope that helps.

Telepresence | Fri Feb 06 2009

To (most) commenters; What is an Alt Tag? What is this?

Jeff | Wed Jan 28 2009

Interesting article. I'm tempted to make a wisecrack about adding blogging to your list, but that would be unnecessarily mean and false.

baby toys | Fri Jan 16 2009

A lot of people don't know that alt tags are another great complementary website optimizers. When your page is already filled with meta keywords you can supplement it with alt tag keywords so that search engine bots don't flag them as duplicates. Thumbs up to the author!

Bluedir | Sun Jan 11 2009

alt tags give meaning to the images. It's very helpful if your images don't load for some reason. Also most web developers forget command line browsers like Lynx. It's also good for Googlebots. You'll be amazed to see how much alts help it organize your site meaningfully.

Robert Riley | Sat Jan 03 2009

I don't know how to do this using the java viewer on my site so I thought of ALT. Can ALT text be 'edited' eg. seperated into 2 or 3 lines rather than 1 long line? (It tends to cover the main image). Sounds simple eh! Any ideas would be most welcome!

Kyle Mallard | Wed Dec 10 2008

What software can i download for free, in order for my "alt" tags to be read out aloud on my computer? I am currently making the supplied URL accessable to the blind, and need to see if my alt tags will be read, and also to let a blind person test the website with there computer, please help, i am desperate for a programme to test this.... thanks a mil. Ciao for now.

Gareth | Thu Nov 06 2008

We have so many images on our site and the people who load them are fully trained to insert alt text (although sometimes this gets missed). We do it primarily so that visually impaired people can see what we are talking about. I was once shown a demo of what a site would look like without the images and without alt text and it made no sense at all!

Mr & Mrs Smith | Tue Nov 04 2008

Thanks for the heads up on the tools - will definitely be using the semantic extractor tool when I get into PPC over the coming months. :)

gömlek | Tue Oct 28 2008

An excellent overview with some sound advice. I wonder whether you consider the id and name attributes (where applicable) as another type of alternative text. I'm not sure whether screen readers or other Internet devices can actually extract this kind of text - the name or id of a form, for example - in a meaningful way, though. That said, however, it seems to me to make sense to name a search form "SearchForm" or a subion form "SubionForm". Content management systems and authoring tools have a tendency, in my experience, to insert their own text like "f_box" or "f_r_t012" which is hard enough for developers to follow, let alone a site visitor. I believe there are the beginnings of a trend, particularly when it comes to labelling div elements with meaningful id attributes. Certainly the magnificent Mr Z (www.zeldman.com) describes this in his book, Designing With Web Standards.

sohbet | Tue Oct 28 2008

Samuel, Excellent article. I'm tempted to make a wisecrack about adding blogging to your list, but that would be unnecessarily mean and false. The former I'm OK with, but the latter is beyond my limits (well, if I were to be prodded...). But really, I absolutely need to make a list and, here's the kicker, actually apply it. One can waste a lot of time achieving very little if they don't heed your advice. Jon Blakemore

toplist | Tue Oct 28 2008

Hi Julian. I didnt to be anything but positive, its just an observation over a lot of experimentation and time, and is also (mostly) the generally accepted view in the SEO community these days I think, that image alt tags dont seem to carry much, if any weighting at all for search engine purposes. - but then we should be writing websites for people not search engines anyway shouldn't we? thats certainly Google's official line, and surely the accessibility approach? with regards to if the image is a hyperlink also then this is a very positive thing as yes, the alt text then becomes the link anchor text and that is just about the most powerfully weighted thing on the page as far as engines are concerned. apologies if my comment was perceived negatively it wasnt meant to be so. kev

seoibiza | Tue Apr 08 2008

Hi Julian. I didnt to be anything but positive, its just an observation over a lot of experimentation and time, and is also (mostly) the generally accepted view in the SEO community these days I think, that image alt tags dont seem to carry much, if any weighting at all for search engine purposes. - but then we should be writing websites for people not search engines anyway shouldn't we? thats certainly Google's official line, and surely the accessibility approach? with regards to if the image is a hyperlink also then this is a very positive thing as yes, the alt text then becomes the link anchor text and that is just about the most powerfully weighted thing on the page as far as engines are concerned. apologies if my comment was perceived negatively it wasnt meant to be so. kev

seoibiza | Tue Apr 08 2008

If Alt Tags are all but useless from an SEO Point of view these days, then how do you know this is true? I think that Alt Tags are very useful for pictures that are just pictures and for pictures that are also links to other pages. i.e. Hyperlinks And another thing if alt tags are useless then what can you say about alt tags or any other html tags that is helpful from an SEO Point of view?? OK granted this page is about Alt Tags and not general SEO Items, but surely its worth posting a comment that helps people and is constructive rather than saying something is usless?! J Bowler

Julian Bowler | Tue Apr 08 2008

@ Matt. Alt text is virtually worthless to search engines these days due to previous abuses. the only times it will make any difference at all with regards to an engine is a) if the page is empty otherwise and it's the only text to be found b) if the image is a hyperlink, then the alt text is the links anchor text as far as SEs are concerned. otherwise ignore alts for search engines and do it correctly fr people.

seoibiza | Tue Apr 08 2008

Look if you are going to put an image onto a web page make sure that there definitely is an alt tag. But more than that, make the Alt tag is deive, relatively short and put a few Keywords into the Alt Tag, hence if you offer Computer Repairs in Reading Berkshire, and your picture shows a computer being repaired in Reading Berkshire, then place the Words Computer Being Repaired in Reading Berkshire into the alt tag,. If you can not write an alt tag read a good book on HTML, thay are chep to buy and you can get one on line from Lulu, where they are printed on demand

Julian Bowler | Sun Apr 06 2008

Yes writing ALT tags is easy enough, but of course if you write one for an image it must contain a good deion of what that image is, and you should try to ensure that the image is relevant to the web page that it is on, then the alt text can also naturally be relevant to the page that the image is on. if an image is itself a link to another page , then the alt tag should say that this is a n image that links to a page, plus the key words that that page has in its title tag also. Finally do not ever stuff in lots and lots of the same keywords that are on the rest of the page, since this may cause the search engine to think you are over using some key words, this can be bad, generally if a key word is more than about 8% of the text this is no good!! If you want help with web site writing in an informal setting come to web spinners a group that meets in Reading Berkshire see our site chephrenrepairs.com or ring us up 0118 9352873 or ring 0750 82 17 244 or email us there is a link on this page mentioned here! J Bowler owner of chephrenrepairs.com

Julian Bowler | Mon Mar 03 2008

Yes writing ALT tags is easy enough, but of course if you write one for an image it must contain a good deion of what that image is, and you should try to ensure that the image is relevant to the web page that it is on, then the alt text can also naturally be relevant to the page that the image is on. if an image is itself a link to another page , then the alt tag should say that this is a n image that links to a page, plus the key words that that page has in its title tag also. Finally do not ever stuff in lots and lots of the same keywords that are on the rest of the page, since this may cause the search engine to think you are over using some key words, this can be bad, generally if a key word is more than about 8% of the text this is no good!! If you want help with web site writing in an informal setting come to web spinners a group that meets in Reading Berkshire see our site chephrenrepairs.com or ring us up 0118 9352873 or ring 0750 82 17 244 or email us there is a link on this page mentioned here! J Bowler owner of chephrenrepairs.com

Julian Bowler | Mon Mar 03 2008

I have heard about ALT tags, now I can't wait to implement them in m website. Thank you for sharing the knowledge. Ciao Francisco

Francisco | Sun Oct 14 2007

Hello, Is it possible to extend the time the alt text is visible?

Roy Egas | Mon Aug 06 2007

How come computers have weird names for specific topic? For example LYNX. Many people say that the well you do it, the better it is. How come in the first paragraph says that when you try to make a picture just right, it will stop your thoughts. It is suppose to help your thoghts. Maybe I'm just wrong but some lessons of making a web doesn't make since.

Susan B. | Tue May 01 2007

what does the letters lumo mean in text writting?

kelly adams | Mon Apr 23 2007

How about corporate logos? If the name of the firm is listed in the main body text, should the image itself have an ALT? I see lots of "General Motors Logo" type ALT tags.

Bryce | Fri Apr 06 2007

Can you use the alt attribute on other tags (e.g. links)?

Sheila | Tue Mar 20 2007

How to get title tag text in addresslink to show more long time?

Rambo | Wed Dec 13 2006

The WCAG say the alt must be short. I advice a maximum 80 characters length because the braille keyboard is between 40 and 80 characters length. This way, the user of braille keyboard can read the alt in one reading or two max

goetsu | Wed Jul 13 2005

Can I control the timming of the tooltip window [...] There's no way to do this, apart from using e.g. ECMAScript to create a similar effect when hovering an image (where you'll be able to control timing and other parameters). Nonetheless, don't forget what the article already states: Internet Explorer gets this wrong [...].

Jens Meiert | Tue Apr 05 2005

Can I control the timming of the tooltip window. I need to extend this time, Thanhks M. Flores

Flores | Sat Jan 22 2005

@ Carol re: "Can ALT text be 'edited' eg. seperated into 2 or 3 lines rather than 1 long line?" I would suggest that, if your alt attributes contain information that could be spread across 2 or 3 lines, you are probably putting more information in them than is necessary or sensible. I'd suggest that any information that is extraneous to conveying the essentials/function of an image should go in a title attribute.

Jon Gibbins | Sat Jan 22 2005

Also meant to say that I have learned even more since reading your site. Many thanks! (and think I mistyped my web address previously. Sorry! Hope it's ok this time. Can't answer the last bit about using XHTML or markup - I'm not sure! Sorry)

carol (The Lost Soul Gallery) | Wed Jan 12 2005

I've been designing sites for only a couple of years and have learned so much. By reading the info on your site I had hoped to find the answer to my querie, but haven't so far! However, you may be able to help!(See my site)I want to display text details about my artwork without cluttering the pages with text. I don't know how to do this using the javascript viewer on my site so I thought of ALT. Can ALT text be 'edited' eg. seperated into 2 or 3 lines rather than 1 long line? (It tends to cover the main image). Sounds simple eh! Any ideas would be most welcome! Thank you.

carol (The Lost Soul Gallery) | Wed Jan 12 2005

The advice is mostly sensible, but the proof-reading is bad. First, there are five typos: therefor, erally, non-existant, frament, attri`ute. Secondly, a book title is given in inverted commas rather than in italicized in the usual convention. Thirdly, there is a hanging participle: "without you (sic) needing to install any additional software". One wouldn't write: "since there is an awning over the outdoor meeting area, you can go outside without needing you hat." The same applies to a phrasal noun. Here "needing to install any additional software" is a phrasal noun; therefore, it requires a possesive pronoun. I believe anyone is concerned with accessibility should be particularly careful to ensure there is good proof reading.

Harry Bartram | Tue Jun 22 2004

you can also read the relevant chapter of Joe's book online: http://www.joeclark.org/book/sashay/serialization/Chapter06.html (but it's well worth reading in dead-tree form, just for the pictures and the "special advertising supplement") thanks for an excellent overview, Dave!

Elaine Nelson | Tue Dec 09 2003

It's worth thinking about search engines and ALT text, although their needs come second to human users.

Matt Williams | Fri Dec 05 2003

"replicate text in full" ... I wouldn't say "no exceptions", because an ALT text of "refer to the large diagram with the red lines" wouldn't be very helpful to a non-visual-enabled visitor.

Eric Scheid | Thu Dec 04 2003

An excellent overview with some sound advice. I wonder whether you consider the id and name attributes (where applicable) as another type of alternative text. I'm not sure whether screen readers or other Internet devices can actually extract this kind of text - the name or id of a form, for example - in a meaningful way, though. That said, however, it seems to me to make sense to name a search form "SearchForm" or a subscription form "SubscriptionForm". Content management systems and authoring tools have a tendency, in my experience, to insert their own text like "f_box" or "f_r_t012" which is hard enough for developers to follow, let alone a site visitor. I believe there are the beginnings of a trend, particularly when it comes to labelling div elements with meaningful id attributes. Certainly the magnificent Mr Z (www.zeldman.com) describes this in his book, Designing With Web Standards.

Owen Gregory | Tue Aug 12 2003

Comments are not available at the moment due to spam problems.

Admin

If you spot an error or have any problems using this site, please contact us and we will do our best to rectify any issues asap. We appreciate all feedback and are constantly working to improve standards of compliancy and accessibility on the GAWDS site.