How long can an "alt" attribute be?

The HTML (Hypertext Markup Language) specification does not define a maximum length for "alt" attributes, (also known as ALT 'text'). Current versions of leading screen reader programs have no limits on the amount of alternate text they will read. So how long should ALT attributes be? And why use ALT attribute? To answer the second question first, besides the obvious benefit for vision-impaired users, ALT attributes benefit sighted users who have images disabled in their browser settings for one reason or another (i.e., to minimize download time, discrete browsing, browser testing). For these users, if a height and width of an image is specified, both Internet Explorer® and Mozilla truncate the alternate text to fit within the size of the image placeholder. If no image width is specified, Internet Explorer displays the entire "alt" attribute on one line, which may result in a web page that is extraordinarily wide and disorienting.

In answering the primary question: How long can an "alt" attribute be? It may be more appropriate to ask: How long should an "alt" attribute be? The reasons described above provide technical justification for keeping the length of "alt" attributes to a minimum, at least shorter than 151 characters. This simply reinforces a common request from screen reader users: Keep alternate text short and meaningful. Alternate text should provide equivalent access to the content of an image, but must do so efficiently in order to avoid burdening screen reader users with extraneous information.

For images that require more lengthy descriptions, the appropriate HTML attribute is not "alt" but "longdesc" (short for "long description"), which allows authors to provide a long description of an image on a separate page. This is particularly useful for complex images such as graphs and charts. Screen readers typically announce the presence of a long description when available, and provide users with the option of reading it.

It is important to note that if an image has no ALT attribute provided, most screen readers will instead read out the image file name, which in itself is usually meaningless and confusing to the user.

See also What is the current recommendation for providing long descriptions for complex graphics?