What is Alt Text?
Alt text is an attribute added to an image to tell the browser what is contained in the image. This is important for accessibility—ensuring users on assistive devices understand the context and contents of the image. Alt text can also act as a fallback if the image is unable to render for any reason. Alt text is important for search engines, too. Without it, the search engine has no way of knowing what the image depicts.
How long should it be?
This is often the first question people have when they sit down to write alt text for their images. Should they be a couple of words? A couple sentences? A paragraph?
Simply put, you want to keep your alt text as short as possible while still describing the image to a reasonable degree. If there are any words pictured, those words will need to be contained in the alt text as well. Be mindful that some screen readers and screen reading software, JAWS for example, will limit the output of alt text to around 150 characters (while providing with the option to hear the rest of the text or to skip).
Should I use punctuation?
Using punctuation in alt text is good practice. It will ensure that your message is read aloud properly and can be understood easily. And as we mentioned, alt text acts as a fall back for images that cannot render. So don’t format your alt text in a way that you wouldn’t want users of your site to see!
Is Alt Text a good place for keywords?
If a keyword that you’re trying to focus can be used to describe your image then it’s definitely a good idea to put it in your alt text. However, the primary focus of alt text should be to describe an image. So avoid spamming keywords or using them in a way that distracts from that focus.