👀 Live Preview
Modern pattern with visible long-description link:
Q1 sales were 12 units, Q2 18, Q3 24, and Q4 30—a steady upward trend across the year.

The longdesc attribute was designed to point from an <img> element to a URL containing a longer description of the image—useful for complex charts or diagrams where alt alone is too short. It is now obsolete in HTML5. Browsers never implemented it consistently, and modern accessibility guidelines recommend on-page descriptions with aria-describedby, <figure>/<figcaption>, or visible “Long description” links instead.
Legacy pattern.
Not in HTML5.
Short vs long.
Modern fix.
Caption + image.
Replace legacy.
longdescThe original purpose of longdesc was to improve accessibility for complex images by linking to a separate document with a full textual description—for example, a detailed explanation of a scientific chart or map that would not fit in the alt attribute.
Because the URL was hidden with no standard UI in most browsers, users often never discovered the long description. HTML5 removed longdesc from the specification. You should understand it when maintaining legacy pages, but not add it to new work.
The old reference suggested using longdesc whenever possible. That advice is outdated. Use the modern patterns in this tutorial instead—they work in today’s browsers and assistive technology.
Legacy syntax (recognition only):
<img src="chart.png" alt="Sales chart 2024" longdesc="chart-description.html">Modern replacement:
<figure>
<img src="chart.png" alt="Sales chart 2024"
aria-describedby="chart-desc">
<figcaption>Sales by quarter</figcaption>
</figure>
<p id="chart-desc">Detailed description of the chart…</p><img> (and rarely <frame> in old HTML).alt as well—longdesc was supplemental, not a replacement.aria-describedby for screen reader associations.longDesc (camelCase) on HTMLImageElement.The longdesc attribute accepted a URL referencing a document with the long description:
longdesc="chart-description.html" — Relative URL on the same site.longdesc="https://example.com/descriptions/photo.html" — Absolute URL.longdesc="#details" — Fragment URL to an on-page section (rarely supported reliably).Modern equivalent uses an element id, not a separate attribute on img:
// Legacy (avoid):
img.longDesc = "old-page.html";
// Modern:
img.setAttribute("aria-describedby", "photo-desc");| Need | Legacy (avoid) | Modern approach |
|---|---|---|
| Short label | alt="..." | alt="..." (still required) |
| Long description | longdesc="page.html" | aria-describedby="id" |
| Visible caption | N/A | <figure> + <figcaption> |
| Link to details | Hidden URL only | Visible “Long description” link |
| Complex chart | Separate HTML file | On-page <div id> or data table |
| Element / Context | Supported? | Notes |
|---|---|---|
<img> | Obsolete | Primary historical use |
<frame> (HTML4 frames) | Obsolete | Legacy framesets only |
<input>, <area> | No | Use alt on area; labels on inputs |
aria-describedby | Modern replacement | On any element including img |
longdesc vs alt vs aria-describedby| Feature | alt | longdesc | aria-describedby |
|---|---|---|---|
| Status | Required standard | Obsolete | Standard WAI-ARIA |
| Length | Short (typically < 125 chars) | Long (separate page) | Long (on-page element) |
| Where text lives | Attribute value | External URL | Element referenced by id |
| Browser UI | Shown if image fails | None (broken UX) | AT reads description |
| Use today? | Yes | No | Yes |
Legacy longdesc markup, a modern accessible figure pattern, and toggling a visible long description.
Modern pattern with visible long-description link:
Q1 sales were 12 units, Q2 18, Q3 24, and Q4 30—a steady upward trend across the year.
<img src="example.jpg" alt="Example Image" longdesc="longdesc.html">The attribute pointed to a separate document. Because discovery failed for most users, the feature was removed from HTML5.
<figure>
<img src="chart.png" alt="Quarterly sales bar chart"
aria-describedby="chart-long-desc">
<figcaption>
Sales 2024
<a href="#chart-long-desc">Long description</a>
</figcaption>
</figure>
<div id="chart-long-desc">
Q1 through Q4 show steady growth from 12 to 30 units…
</div>The description stays on the same page where everyone can find it. aria-describedby links the image to the detailed text programmatically.
<img id="diagram" src="diagram.png" alt="Network diagram"
aria-describedby="diagram-desc">
<button type="button" aria-expanded="false" aria-controls="diagram-desc">
Show long description
</button>
<div id="diagram-desc" hidden>…</div>An expandable panel replaces the hidden external URL pattern of longdesc with discoverable, keyboard-accessible UI.
alt — Even with a long description, images need concise alternative text.longdesc on new sites — It is obsolete and poorly supported.aria-describedby or a visible anchor.aria-expanded on toggles — Announce show/hide state for description panels.Points off-page.
No standard link UI.
Users miss details.
On-page, visible, reliable.
The longdesc attribute is obsolete. No browser provides a standard, discoverable UI for it. Firefox once offered optional longdesc discovery; most engines ignore the attribute for practical purposes.
Do not depend on longdesc in any modern browser.
Bottom line: Recognize it in legacy HTML; migrate to aria-describedby and visible description links.
alt text on every meaningful imagearia-describedby to associate img with description idlongdesc when refactoring legacy pageslongdesc to new markupaltThe longdesc attribute was an early attempt at long image descriptions via external URLs, but poor browser support and hidden discovery led to its removal from HTML5.
For accessible, inclusive pages today, combine alt with on-page detailed text linked through aria-describedby, <figure>, and visible description controls. That approach serves both assistive technology and sighted users.
longdescBookmark these before describing complex images.
Not in HTML5
StatusExternal page
LegacyShort summary
RequiredModern link
ReplaceDiscoverable UI
UXaria-describedby referencing an on-page element, plus a visible long-description link or expandable section.alt is a short summary in the attribute itself. longdesc pointed to a long external description. Keep alt brief; put long text in page content.img.longDesc. New code should set aria-describedby instead.Learn why longdesc was retired and practice aria-describedby with visible description links in the Try It editor.
5 people found this page helpful