Please tell me if there is any any specific number of characters that can be entered in alt attribute of img tag of html
-
Sharing your research helps everyone. Tell us what you've tried and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer! Also see [how to ask](http://stackoverflow.com/help/how-to-ask) – Scott Solmer Nov 26 '14 at 13:21
-
definite duplicate and a quick Google search gives a link to several answers on here – ShufflerShark Nov 26 '14 at 13:22
2 Answers
The HTML specification does not define a maximum length for "alt" attributes. Current versions of the leading screen reader programs have no limits on the amount of alternate text they will read. However, Freedom Scientific JAWS [1] divides the "alt" attribute into distinct chunks of 125 characters each (excluding spaces), and reads them each separately as if they were separate graphics. This behavior, though it ultimately provides access to the entire "alt" attribute, can be confusing for the user. Also, keep in mind that "alt" attributes additionally benefit sighted users who have images disabled in their browser settings, perhaps in order to minimize download time. For these users, if the 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.
All of this provides technical justification for keeping the length of "alt" attributes to a minimum, at least shorter than 125 characters in order to avoid JAWS subdividing it. This simply reinforces a common request from screen reader users: Keep alternate text short and sweet. 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.

- 329
- 3
- 10
There is no limit for the alt tag. however i recommend to keep it sort and clean, may be 125 characters or fewer.

- 156
- 7
-
2What is the rationale behind those 125 characters? Isn't that a totally arbitrary number? – Tsundoku Mar 03 '22 at 13:14