The alt attribute, commonly called "alt text," is an HTML attribute added to image tags that provides a text description of the image. It serves two primary purposes: helping search engines understand what an image depicts (since search engines cannot directly "see" images), and providing accessibility for users who rely on screen readers or encounter broken images.

How Alt Text Works

In HTML, the alt attribute is written directly within the image tag: <img src="dog.jpg" alt="Golden retriever playing in a park">. When a search engine crawls a page, it reads the alt text to understand the image context, which can contribute to the page's overall relevance signals. If the image fails to load in a browser, the alt text is displayed in its place. Screen reader software reads the alt text aloud to visually impaired users, making it a critical component of web accessibility standards.

Key point: Good alt text is descriptive and concise — typically under 125 characters. It should accurately describe the image's content and context, not stuff keywords unnaturally.

Best Practices for Writing Alt Text

Writing effective alt text is a balance between descriptiveness and brevity:

  • Describe the image specifically — "woman coding on a laptop" rather than "image" or "photo"
  • Include relevant keywords naturally where they genuinely describe the image
  • Do not start with "image of" or "picture of" — screen readers already announce these as images
  • Leave the alt attribute empty (alt="") for purely decorative images
  • For images containing text, reproduce that text in the alt attribute

Why It Matters for SEO

Alt text gives search engines the contextual information they need to index images appropriately, which can drive traffic through Google Image Search. It also reinforces the topical relevance of a page, contributing to overall rankings. Beyond SEO, accessibility is increasingly a legal requirement in many jurisdictions, and well-written alt text ensures compliance. Images without alt text are a missed SEO opportunity and a barrier to accessible web experiences.