The labelattribute supplies a human-readable name for an <optgroup>, <option>, or <track>. Browsers show that text in select lists and in video/audio caption menus.
It is not the <label> element (which captions a form control, often with for). Same word, different job.
Baseline · Widely available.
Not deprecated and not experimental. Stable on optgroup, option, and track across modern browsers.
Required on optgroup.
In normal HTML, optgroup must have a label (unless a child <legend> is used in a customizable select). Empty groups confuse users.
Syntax
HTML Syntax
syntax.html
<optgroup|option|track label="text">
text is any user-facing string (for example Theropods or English Captions).
Values
Attribute Values
A single text string. Meaning depends on the element:
Element
What label does
Try it
<optgroup>
Name of the option group in the select UI (required in typical use)
kind classifies the track; label names it in the UI.
srclang is the language code; users usually prefer the friendly label.
Keep combinations unique. Do not reuse the same kind + srclang + label on one media element.
Write for people. Prefer English Captions over bare en.
Edge Cases & Pitfalls
Most confusion is mixing up the attribute with the <label> element, or skipping required group names.
compare
Attribute ≠ <label> element
Use <label> / for to name form controls. Use the label attribute on optgroup, option, and track.
required
Always name optgroup
MDN/HTML: label is mandatory for normal optgroup use. Groups without a name are hard to understand.
option
Empty option label falls back
If the attribute is missing or empty, display uses the option’s text content. Do not rely on exotic label/text splits without testing browsers.
track
Unique track identity
A media element cannot have two tracks with the same kind, srclang, and label. Change the label when you add another track of the same kind/language.
nesting
No nested optgroup
Option groups cannot nest. Use flat groups with clear label text instead.
Compatibility
Browser Support
label is an HTML attribute on form and media elements in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
label
Widely supported on optgroup and option since early HTML, and on track with HTML5 text tracks (about July 2015+). Safe for production selects and caption menus.
98%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet Exploreroptgroup/option; track IE10+
Supported
label attributeWidely supported
Bottom line: Use freely for optgroup and track titles. Test option label vs text if you need them to differ.
Remember
Key Takeaways
Role: human-readable name for optgroup, option, or track.
Not the element: form captions use <label> / for instead.
optgroup: always provide a clear group label.
track: menu titles come from label, not from srclang alone.
One line: the label attribute names groups, options, and tracks in the UI — do not confuse it with the <label> tag.
Frequently Asked Questions
It gives a human-readable name to an optgroup, an option, or a track. Browsers show that text in select lists and caption/subtitle menus.
No. The label attribute names optgroup/option/track items. The label element associates caption text with a form control (often with the for attribute).
Mainly optgroup (required in normal use), option (optional; falls back to the option’s text), and track (title in the media player’s track list).
Yes in typical HTML: the label attribute must be specified unless a child legend is used in a customizable select. Without a name, the group has nothing useful to show.
The browser uses the option’s text content as the displayed label. Set label when you want a different display string than the text or value.
Players list tracks by label (for example English Captions), not by the srclang code. Clear labels help users pick the right captions or subtitles.