How do I write alt text and name website images?

Short answer

Write alt text as a few plain words that say what the image shows or does, such as "Dalmatian puppy playing fetch", and name the file the same way (dalmatian-puppy-fetch.jpg, not IMG00023.JPG). Use an empty alt (alt="") for pure decoration, and never stuff keywords, which Google calls spam.

On this page

How do I decide what alt text an image needs?

Ask what the image is doing on the page, then write for that job. The W3C's alt text decision tree asks, in order: does the image contain text, is it inside a link or button, does it add meaning, or is it purely decoration?

Image typeWhat the alt should doExample
Informative photoBriefly say what it showsChef plating a seared salmon dish
Image in a link or buttonSay where it goes or what it doesCall Harbor Plumbing
Image of text (a sign, a flyer)Include the text, unless it is real text nearbyGrand opening Saturday, 10 AM
Decorative (divider, texture)Empty alt, alt=""(nothing)
Chart or complex imageShort alt, full detail in the page textPrices by service, listed in the table below
Logo linked to the homepageThe business nameHarbor Plumbing

Test any image with one question from WebAIM's alt text guide: if you removed the image, would meaningful content be lost? If not, use an empty alt.

How do I write good alt text?

Keep it short and specific: WebAIM says that typically only a few words are necessary, and occasionally a short sentence or two. Do not start with "image of" or "photo of" because screen readers already announce that it is an image. If the type matters, name it ("Painting of..."). When a visible caption already says the same thing, use an empty alt so people using screen readers do not hear it twice.

Google adds that alt text is the most important metadata for images, that it helps accessibility, and that it works as anchor text when the image is a link. It also says keyword stuffing is spam. Google's own image guidance rates a bare alt="puppy" as better than nothing, and alt="Dalmatian puppy playing fetch" as best, and shows a long run of repeated keywords as bad.

BusinessWeakBetter
Barberhaircut barber best fade Norfolk cheapBarber finishing a skin fade on a customer
ContractorkitchenFinished kitchen with white shaker cabinets and a quartz island
Musicianphoto of bandThe Harbor Lights trio on stage at the Norfolk Waterside
RestaurantfoodShrimp and grits in a cast-iron skillet
SalonIMG_2231Stylist applying balayage highlights

How should I name image files?

Use short, descriptive names with hyphens. Google's guidance gives my-new-black-kitten.jpg as the pattern, instead of IMG00023.JPG, and says to avoid generic names like image1.jpg, pic.gif or 1.jpg. Put the image near the text on the page that matches it, and use the same URL if you reuse the image on several pages so Google can cache it.

Filename pattern

what-where-detail.jpg
Examples:
shrimp-and-grits-skillet.jpg
kitchen-remodel-white-shaker-cabinets.jpg
harbor-lights-trio-norfolk-waterside.jpg
Rules: lowercase, hyphens not spaces, under about 60 characters, no "final2" or "IMG".

What technical details matter?

Three technical rules from Google and web.dev keep your images findable and fast: - Use real image tags. Google says it does not index CSS background images, so put meaningful photos in <img> elements with a src attribute. Supported formats are BMP, GIF, JPEG, PNG, WebP, SVG and AVIF, and the file extension should match the real file type. - Reserve space. Add width and height to every image so the page does not jump around while it loads (web.dev). - Lazy-load below the fold only. loading="lazy" defers offscreen images. web.dev says not to lazy-load images likely to be in the viewport at load, especially the main (LCP) image, which is better with fetchpriority="high".

Our website speed post explains why this affects how fast the page feels on a phone. Google also suggests a preferred image for a page through og:image, and says to avoid generic choices such as logos or images containing text.

What is a quick routine for a new upload?

  1. Rename the file before uploading: what-where-detail.jpg.
  2. Decide the job: informative, link, text or decoration.
  3. Write the alt in 3 to 10 words.
  4. Set width and height, and lazy-load it unless it is at the top.
  5. Check by tabbing through the page or with a screen reader preview.
  6. Keep a note in your handover list. Our prepare for a web designer post suggests labeling photos when you send them.

How do I check the images on my current site?

Pick the 10 most important images: the header photo, your logo, and the photos on your top service pages. Right-click each and choose Inspect, or ask whoever manages the site to export the list. For each, note the filename, the alt text and whether it sits in a link. Fix the weakest first: any image named IMG_ or DSC_, any alt that is empty on a meaningful photo, and any alt that is a string of keywords. Two or three of these edits are a ten-minute job, and they help people who use screen readers as much as they help search.

What does this look like on real sites?

  • A food truck with 12 menu photos. Name them by dish and write one alt per dish: "Birria tacos with consomé". Do not repeat the truck name 12 times.
  • A contractor with before-and-after pairs. Alt: "Kitchen before remodel with dated oak cabinets" and "Kitchen after remodel with white shaker cabinets". The words carry the story.
  • A musician's header photo. If the band name is in the heading, the alt can be "The band on stage under red lights" or empty if purely decorative.
  • A linked logo. Use the company name as the alt, not "Acme logo link".

From our side

You see a live preview during our build, so you can check that each photo shows the real work and that the words around it match. We keep refining within the agreed work until you are happy. Launch is $549 and Grow is $1,099; see our process.

Key takeaways

  • 01Write alt text in a few words describing what the image shows or does.
  • 02Use empty alt for decoration, and never stuff keywords.
  • 03Name files with short, descriptive hyphenated words, not IMG numbers.
  • 04Put important photos in real img tags, with width and height set.
  • 05Lazy-load below the fold, not the main image.

Quick answers

How long should alt text be?

WebAIM says a few words is typically enough, sometimes a short sentence. Complex images can have a longer description in the page text.

Do I need alt text on a decorative image?

Yes, an empty one. alt="" tells screen readers to skip it.

Does Google read filenames?

Google recommends short, descriptive filenames, such as my-new-black-kitten.jpg instead of IMG00023.JPG, and says alt text is the most important image metadata.

Should I start alt text with "image of"?

No. Screen readers already announce an image, so the phrase is redundant.

Free tool

Check source HTML for accessibility issues with alt attributes, control names, zoom, and landmarks. Run the free Accessibility Checkup.

Keep reading

More straight answers.