The alt tag, short for alternative text, is a text description of an image that sits in the HTML code of a page. It makes the content of an image available to screen readers and search engines. That matters above all for users with a visual impairment, because the alternative text can be read aloud when the image itself is not visible.
Alt text is an attribute of the image element and not a tag of its own, even though the name alt tag has stuck. It is a fixed part of web development and of online marketing.
How do you set an alt tag?
To add an alt tag to an image on a web page, you use the alt attribute inside the <img> tag of the HTML code. The alt text should be short but meaningful and should describe the content and the context of the image clearly. Here is a simple example:
<img src="/example-image.jpg" alt="Example image of a blue sky with white clouds">
In this example the alt attribute gives a clear description of what the image shows. It is worth including relevant keywords, without overloading the text or adding information that has nothing to do with the image.
Are alt tags important for SEO?
Alt tags play an important role in search engine optimization (SEO), because they help search engines understand what an image shows. That improves the accessibility of your website and raises the chance that your images turn up in the image search results. Alt tags also reinforce the context of a page when they carry relevant long-tail keywords, which can improve the SEO performance of the whole page.
Keep in mind that overloading alt tags with keywords, a practice known as keyword stuffing, can be judged negatively by search engines and can work against your SEO. So the focus belongs on precise, relevant descriptions that help visitors and search engines alike.
Alt texts belong on every image of a site, which is why missing alt attributes are one of the standard checks in our SEO audit.