Image Alt Text Basics for SEO and Accessibility
What alt text is and why it exists
Alt text, short for alternative text, is a written description of an image that is embedded in the HTML code of a web page. It was originally created for accessibility: when a visually impaired person uses a screen reader to browse a website, the screen reader reads the alt text aloud so the person understands what the image shows.
Alt text also appears when an image fails to load, such as when a visitor has a slow connection, has disabled images, or when the image file is missing. In these cases, the alt text provides context that would otherwise be lost. Search engines also use alt text to understand the content of images, which affects how pages appear in search results and image search.
How alt text affects SEO
Search engines cannot see images the way humans do. They rely on surrounding text, file names, and alt text to determine what an image depicts and how it relates to the page content. Well-written alt text helps search engines index your images correctly, which can drive traffic through Google Image search and improve the overall relevance signals of your page.
Alt text is not the place to stuff keywords or repeat your page title. Search engines are sophisticated enough to recognize keyword stuffing, and it can actually harm your rankings. Instead, write natural descriptions that accurately convey what the image shows and how it relates to the page content.
How to write effective alt text
Good alt text describes the purpose of the image in the context of the page. A product image might need the product name, color, and a notable feature. A chart might need a summary of what the data shows. A team photo might describe who is in the image and what they are doing.
Keep alt text concise, typically under 125 characters, because some screen readers truncate longer text. Start with the most important information and avoid starting with "image of" or "picture of" because screen readers already announce that the element is an image.
Be specific rather than generic. "Red leather women's wallet with zipper closure" is more useful than "product photo" for both screen readers and search engines. The description should give the reader enough information to understand why the image is on the page.
When to use empty alt text
Not every image needs descriptive alt text. Decorative images that do not add informational content to the page should use empty alt text, written as alt="" in the HTML. This tells screen readers to skip the image entirely rather than announcing "image" with no context.
Examples of decorative images include background textures, divider lines, purely decorative icons that repeat information already in the text, and spacing images. If removing the image would not change the meaning of the page, it is probably decorative and should have empty alt text.
Alt text for different image types
Product images should include the product name, key attributes like color and material, and any visible details that would help a shopper decide. For example: "Navy blue canvas backpack with front zipper pocket and padded laptop compartment."
Informational images like charts, graphs, and diagrams should summarize the key takeaway. For example: "Bar chart showing website traffic increased 45 percent between January and June 2026."
Screenshots should describe what the screenshot shows and why it is relevant. For example: "WordPress media library upload dialog showing the WEBP format option."
Common alt text mistakes
The most common mistake is leaving alt text empty on important images. This creates a gap in understanding for screen reader users and misses an opportunity for search engine indexing. Every informational image should have descriptive alt text.
Another frequent mistake is writing the same alt text for multiple images. Each image shows something different, so each alt text should be unique. Repeating "product photo" across all images on a page provides no useful information to anyone.
Avoid using the file name as alt text. "IMG_4592.jpg" or "photo-1.png" tells neither humans nor search engines anything about the image content.
Pairing alt text with image optimization
Alt text and image optimization are separate concerns, but both contribute to a well-built page. Alt text helps with accessibility and SEO relevance, while compression and resizing help with page speed and performance metrics. The best practice is to handle both when preparing images for publication.
When you compress and resize an image for your website, take a moment to also write meaningful alt text for it. This small additional step improves both the user experience and the search engine performance of your page.
Try these PixelXTrim tools
- Compress Image — optimize images alongside writing good alt text
Why use PixelXTrim?
PixelXTrim is free, needs no signup, adds no watermark, and processes supported images in your browser. Keep your original, preview the result, download a copy, and check that copy where it will be used.