Alt text, short for alternative text, appears in the HTML of a webpage as an attribute of the image tag. When a screen reader encounters an image, it reads the alt text aloud to the user. When an image fails to load, the alt text appears in the space where the image would have been. Search engines also use alt text to understand the content of images since they cannot see images the way humans can. A well-written alt text serves all three of these purposes simultaneously.

The fundamental rule of writing alt text is to describe what the image shows in a way that conveys the same information to someone who cannot see the image as the image itself conveys to someone who can. For a photograph of a small business owner working at a desk reviewing documents, appropriate alt text might be: small business owner reviewing financial documents at a desk. This tells a screen reader user what is in the image without requiring them to see it. It does not begin with image of or photo of, which are redundant because screen readers already announce that an image is present.

Context affects what alt text should say. The same photograph in different contexts might need different alt text. In a section about bookkeeping services, the alt text might be business owner using QuickBooks to manage accounts. In a section about workspace setup, the same photo might become organized home office with natural lighting. The alt text should be informed by why the image is there and what it is meant to communicate in its specific context, not just what it depicts in the abstract.

Decorative images do not need alt text. An image that is purely decorative and adds no meaningful information to the page should have an empty alt attribute, written as alt equal open-close quotes, rather than a description. This tells screen readers to skip the image entirely. Using an empty alt attribute is deliberate: leaving the alt attribute out entirely causes screen readers to announce the image filename, which is unhelpful. A common decorative image that should have empty alt text is a background gradient, a spacer image, or a purely visual divider between content sections.

Functional images, such as icons used as buttons or linked images that navigate to another page, need alt text that describes the function rather than the appearance. A search icon used as a submit button should have alt text of search, not magnifying glass. A logo image that links to the homepage should have alt text of brand name home or company name logo, since clicking it takes the user to the homepage. The function of the image is what the user needs to understand, not the visual appearance.

Writing good alt text is a habit that becomes natural with practice, and the combination of better accessibility, stronger search engine optimization, and more robust image handling when load failures occur makes it one of the most straightforward improvements to implement across any website or digital content program.