The alt attribute defines text that can replace an image when the picture is not available — for screen readers, users who turn images off, or when the file fails to load.
On <img>, pair it with src. Also used on <area> (image maps) and <input type="image">. Write a concise replacement for the image’s meaning — not the word “image” or the file name.
Baseline · Widely available.
Not deprecated. Essential for accessibility. Stable across modern browsers since about July 2015.
Do not omit it.
Missing alt may make screen readers announce the file name. For decoration, use an explicit empty value: alt="".
Syntax
HTML Syntax
syntax.html
<img src="…" alt="text">
Use alt="" when the image is decorative and should be ignored by assistive technology.
The image is the link — alt becomes the accessible name.
Prefer the action (“Visit MDN”) over “logo” or “arrow”.
If text is beside the image in the same link, often use alt="" to avoid duplication.
Do not rely on title instead of alt.
Edge Cases & Pitfalls
Most alt mistakes are “too vague,” “missing,” or “duplicated.”
omit
Missing alt ≠ empty alt
Leave the attribute off and some screen readers speak the file name. Use alt="" for decoration.
title
title is not a backup
Do not put the same string in title and alt. For captions, use <figure> and <figcaption>.
keywords
Avoid keyword stuffing
Alt is for people first. Stuffing SEO phrases hurts clarity and trust.
maps
<area> needs useful labels
Linked regions in an image map should have non-empty alt that describes the choice.
context
Same file, different alt
Alt depends on context. A chart may need a summary; a logo in a nav may say the site name.
Compatibility
Browser Support
alt is an HTML attribute for images (and related elements) in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
alt
Supported everywhere images are. Assistive technologies rely on it; visual browsers show it when the image cannot load.
100%Attribute support
Google ChromeAll modern
Full support
Mozilla FirefoxAll modern
Full support
Apple SafariAll modern
Full support
Microsoft EdgeAll modern
Full support
OperaAll modern
Full support
Samsung InternetAll modern
Full support
Internet ExplorerAll versions with images
Supported
altWidely supported
Bottom line: Always provide alt. Use meaningful text for content images and alt="" for pure decoration.
Remember
Key Takeaways
Role: text replacement for the image’s meaning.
Empty:alt="" for decoration — do not omit the attribute.
Quality: describe content or action — not “image” or the file name.
Not title:title is not a substitute for alt.
One line: every <img> needs alt — meaningful text, or alt="" if it is only decoration.
Frequently Asked Questions
It provides text that can replace an image when the image is not shown — for screen readers, blocked images, or load errors. On img it is a textual replacement for the picture.
Primarily img. It is also used on area (image maps) and input type="image" (submit buttons that are images).
Use alt="" for purely decorative images (or when nearby text already says the same thing). That tells assistive tech to skip the image.
No. Missing alt may cause screen readers to announce the file name. Prefer an explicit empty alt for decoration.
No. title is not a substitute. Do not duplicate the same string in both — some screen readers may read it twice.
No. It is required for accessible images and is Baseline widely available.