Alt Text (alt attribute)

Alternative text for images. Important for accessibility and SEO, displayed when images cannot be loaded.

Alt text (alternative text) is a description of an image specified in the alt attribute of the HTML <img> tag. It is displayed when images fail to load and is read aloud by screen readers for visually impaired users. Although this specification has existed since the early days of the Web, its importance has grown in both accessibility and SEO, making it an essential element in modern web development.

Alt text is essential for accessibility. When users with visual impairments browse pages using screen readers, alt text conveys the image content. WCAG (Web Content Accessibility Guidelines) 2.1 Success Criterion 1.1.1 requires that all non-text content be provided with a text alternative. For example, a chart image should be described as "Bar chart showing monthly sales trends for 2024," capturing the essential information the image conveys. Web accessibility guides explain the importance of alt text.

For SEO, alt text is a key signal for search engines to understand image content. It affects Google Image Search rankings, and well-crafted alt text with relevant keywords drives traffic from image searches. In practice, e-commerce sites that set specific alt text for product images (such as "Red leather tote bag, A4 size compatible") have reported increased traffic from image search results.

Writing effective alt text involves several key points. First, describe the image content concisely and accurately, keeping it under 125 characters. Redundant prefixes like "image of" or "photo of" are unnecessary. Keyword stuffing can lead to penalties and should be avoided. Decorative images should use empty alt attributes (alt="") so screen readers can skip them. SEO image optimization guides cover alt text best practices.

A common misconception is confusing alt text with the title attribute. The title attribute displays as a tooltip on mouse hover and is not a substitute for alt text. Additionally, CSS background images cannot have alt attributes, so important information should never be conveyed solely through background images.

From a character counting perspective, alt text length affects the overall text volume of a page. Although not visually displayed, search engines index alt text, so it is worth considering alt text when assessing the total character count of a page.