How long can an "alt" attribute be?
Alternate text for images, often abbreviated "alt text", is supported by all major document publishing formats, most famously Hypertext Markup Language (HTML), the language of the World Wide Web. The purpose of alt text is to provide a text equivalent of an image, so people who are unable to see the image have access to the message it’s intended to convey.
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, there are at least two good reasons to keep alt text "short and sweet".
First, if alt text is too lengthy, it can unnecessarily interrupt the content reading flow for screen reader users. Alternate text should provide equivalent access to the content of an image, but must do so efficiently in order to avoid burdening users with extraneous information.
Second, most browsers display alt text visually if an image fails to display. This might happen if there's a typo in the image file path or a network error; or it will happen on mobile devices if the user has disabled images in order to conserve bandwidth and keep costs down. Alt text should therefore be short enough to reasonably fit within the space allocated for the image.
Essentially, alt text should be as long as it needs to be in order to effectively describe the content, but should be succinct.
For complex images such as charts, graphs, and diagrams that require more lengthy descriptions, there are other options. For details see the Knowledge Base articles Are there guidelines for describing complex images?, What is the current recommendation for providing long descriptions for complex graphics?, and What constitutes good alt text?