Tips for Writing Alt Text
html + accessibility
2 min read
Alt text, also known as "alt descriptions" or "alternative text," is used to describe images on websites and other digital media. When asked, I like to tell the person to imagine they are describing an image to someone over the phone. Alt descriptions are an essential accessibility feature that can significantly improve the usability of your website for people with disabilities. Here are some tips for writing alt descriptions:
Consider the image's purpose:
Ask yourself why the image is included on the page and what information it conveys. This will help you create an effective alt description.
Alt text should be brief and to the point, usually no more than a sentence or two.
Alt text should provide a clear and accurate description of the image by including details such as the subject matter, colors, and other relevant information.
Don't include unnecessary details:
While it's important to be descriptive, avoid including unnecessary details that don't add value.
Avoid subjective language:
Stick to objective descriptions that are factual and free of bias.
Don't use the filename as the alt text:
The filename of an image is often not descriptive and may not provide any useful information about the image. Instead, use a meaningful alt description.
Don't start with "Image of" or "Picture of":
Screen readers already announce that an image is present, so these phrases are redundant and add unnecessary clutter.
And last but not least, Test your alt text:
Test your alt descriptions to ensure they are read aloud by screen readers and convey the intended meaning.
✅ Do this: <img alt=”A black German Shepherd puppy looking up.” src=”puppy.jpg” /> ❌ Don't do this: <img src=”puppy.jpg” /> Screen reader will speak the image name ❌ Don't do this: <img alt="puppy.jpg" src=”puppy.jpg” /> Screen reader will also speak the image name ❌ Don't do this either: <img alt="puppy" src=”puppy.jpg” /> "puppy" ? cool story bro