Alt text (alternative text), also known as “alt attributes”, “alt descriptions,” and colloquially but technically incorrectly as “alt tags,” are used within an HTML code to describe the appearance and function of an image on a page.
Alt text uses:
1. Adding alternative text to photos is first and foremost a principle of web accessibility. Visually impaired users using screen readers will be read an alt attribute to better understand an on-page image.
2. Alt tags will be displayed in place of an image if an image file cannot be loaded.
3. Alt tags provide better image context/descriptions to search engine crawlers, helping them to index an image properly.
The highlighted text shows the alt text (alt attribute) of the image at left.
Code sample
<img src="pupdanceparty.gif" alt="Puppies dancing">
Optimal format
The best format for alt text is sufficiently descriptive, but doesn’t contain any spammy attempts at keyword stuffing. If you can close your eyes, have someone read the alt text to you, and imagine a reasonably accurate version of the image, you’re on the right track.
Let’s look at a few examples of alt text for this image of a delicious-looking stack of blueberry pancakes:
Okay:<img src="pancakes.png" alt="pancakes">
This alt text is only “okay” because it’s not very descriptive. Yes, this is an image of a stack of pancakes. But, there’s more to be said about this image.
Better:
<img src="pancakes.png" alt="Stack of blueberry pancakes with powdered sugar">
This alt text is a better alternative because it is far more descriptive of what’s in the image. This isn’t just a stack of “pancakes” (as the first alt text example demonstrated); it’s a stack of blueberry pancakes with a dusting of powdered sugar!
Not recommended:
<img src="pancakes.png" alt="">
or
<img src="pancakes.png" alt="pancake pancakes pan cake hotcakes hotcake breakfast food best breakfast top breakfasts breakfast recipes pancake recipe">
Neither of these examples are recommended. The first line of code actually doesn’t contain any alt text at all (notice the quotes are empty), while the second example demonstrates keyword stuffing in alt text.
Why is alt text important?
1. Accessibility
Alt text is a tenet of accessible web design. Its original (and still primary) purpose is to describe images to visitors who are unable to see them. This includes screen readers and browsers that block images, but it also includes users who are sight-impaired or otherwise unable to visually identify an image. Including alt text with your images ensures all users, regardless of visual ability, can appreciate the content on your site.
2. Image SEO
Using alt text on your images can make for a better user experience, but it may also help earn you both explicit and implicit SEO benefits. Along with implementing image title and file naming best practices, including alt text may also contribute to image SEO.
While search engine image recognition technology has vastly improved over the years, search crawlers still can’t “see” the images on a website page like we can, so it’s not wise to leave the interpretation solely in their hands. If they don’t understand, or get it wrong, it’s possible you could either rank for unintended keywords or miss out on ranking altogether.
Here’s an example: Google might see the following image and be able to decipher that it’s a man wearing a tie and glasses, sitting at a desk.
Jim Halpert from The Office (US version)
If you’re trying to rank for “Jim Halpert’s impersonation of Dwight Schrute,” though, you’ll need to lend the search engine a helping hand.
In that sense, alt text offers you another opportunity to include your target keyword. With on-page keyword usage still pulling weight as a search engine ranking factor, it’s in your best interest to create alt text that both describes the image and, if possible, includes a keyword or keyword phrase you’re targeting.
How do I write good alt text?
- Describe the image as specifically as possible. Alt text is, first and foremost, designed to provide text explanations of images for users who are unable to see them. if an image truly doesn’t convey any meaning/value and is just there for design purposes, it should live within the CSS, not HTML.
- Keep it (relatively) short. The most popular screen readers cut off alt text at around 125 characters, so it’s advisable to keep it to that character count or less.
- Use your keywords Alt text provides you another opportunity to include your target keyword on a page, and thus another opportunity to signal to search engines that your page is highly relevant to a particular search query. While your first priority should be describing and providing context to the image, if it makes sense to do so, include your keyword in the alt text of at least one image on the page.
- Avoid keyword stuffing. Google won’t dock you points for poorly written alt text, but you’ll be in trouble if you use your alt text as an opportunity to stuff as many relevant keywords as you can think of into it. Focus on writing descriptive alt text that provides context to the image and if possible, includes your target keyword, and leave it at that.
- Don’t use images as text. This is less of an alt text-specific best practice and more of a general SEO-friendly web development tenet. Because search engines can’t read text within your images, you should avoid using images in place of words. If you must do so, explain what your photo says within your alt text.
- Don’t include “image of,” “picture of,” etc. in your alt text. It’s already assumed your alt text is referring to an image, so there’s no need to specify it.
- Don’t forget longdesc=””. Explore using the longdesc=”” tag for more complex images that require a longer description.
- Don’t neglect form buttons. If a form on your website uses an image as it’s “submit” button, give it an alt attribute. Image buttons should have an alt attribute that describes the function of the button like, “search”, “apply now”, “sign up,” etc.
What does good alt text look like?
Let’s take a look at a couple examples of alt text in action:
Okay alt text: <img src="bird.png" alt="Rooster">
Better alt text: <img src="bird.png" alt="Rooster crowing">
Best alt text: <img src="bird.png" alt="Red-crested rooster crowing">
Okay alt text: <img src="escalator.jpg" alt="man on escalator">
Better alt text: <img src="escalator.jpg" alt="man walking on escalator">
Best alt text: <img src="escalator.jpg" alt="man wearing backpack walking down escalator">
Okay alt text: <img src="kwe.png" alt="kw explorer">
Better alt text: <img src="kwe.png" alt="keyword research in Keyword Explorer">
Best alt text: <img src="kwe.png" alt="Moz Keyword Explorer tool for SEO keyword research">