👀 Live Preview
Open the CC menu to see the track label in the player:
The menu shows English Captions from label="English Captions", not the raw srclang="en" code.

The label attribute is used on the <track> element to provide a user-readable title for a text track. When someone opens the captions or subtitles menu in a video player, they see each track’s label—for example, “English Captions” or “Español”. Text tracks work with <video> and <audio> to show synchronized captions, subtitles, descriptions, and chapter markers.
Menu-visible title.
Plain text only.
UI name vs code.
Distinct track names.
Attribute vs element.
Update at runtime.
labelThe primary purpose of the label attribute is to give each text track a clear, human-readable name in the media player UI. Without meaningful labels, users cannot tell which track is English captions, which is Spanish subtitles, or which is an audio description.
The label works together with kind (track type), srclang (language code), and src (WebVTT file). While srclang tells machines the language, label is what people actually read when choosing a track.
HTML also has a <label> element for forms, which uses the for attribute to link to inputs. This tutorial covers the label attribute on <track> only.
Add label on a <track> element inside <video> or <audio>:
<video controls>
<source src="video.mp4" type="video/mp4">
<track
src="captions_en.vtt"
kind="captions"
srclang="en"
label="English Captions"
default>
</video><track> elements inside <video> or <audio>.kind.kind, src, and srclang for a complete text track.The label attribute accepts any user-readable text string. Common patterns include:
label="English Captions" — Language plus track type for clarity.label="Español" — Language name when the kind is obvious from context.label="English CC" — Short form for closed captions.label="Audio description" — Describes a kind="descriptions" track.label="Chapters" — Navigation markers for long videos.In JavaScript, read or set the property on the track element:
document.querySelector("track").label = "Updated Track Label";| Use Case | Example label | Notes |
|---|---|---|
| English captions | English Captions | Pair with kind="captions" |
| Spanish subtitles | Español | srclang="es" |
| Two English tracks | English CC vs English SDH | Labels must differ |
| Audio description | Audio description | kind="descriptions" |
| Chapter list | Chapters | kind="chapters" |
| JavaScript | track.label = "..." | DOM property |
| Element / Context | Supported? | Notes |
|---|---|---|
<track> in <video> | Yes | Primary use case |
<track> in <audio> | Yes | Lyrics, transcripts |
<label> form element | No | Uses for, not a label attribute |
<input>, <option> | No | Different labeling patterns |
label vs srclang| Feature | label | srclang |
|---|---|---|
| Purpose | User-visible menu text | Machine-readable language tag |
| Example value | English Captions | en |
| Shown in player UI | Yes | Usually hidden |
| Format | Free text | BCP 47 (e.g. en-US) |
| Both needed? | Yes—use together on the same <track> | |
A single captions track, multiple labeled language options, and updating label with JavaScript.
Open the CC menu to see the track label in the player:
The menu shows English Captions from label="English Captions", not the raw srclang="en" code.
Here’s an example of how the label attribute is used within the <track> element:
<video controls>
<source src="video.mp4" type="video/mp4">
<track
src="captions_en.vtt"
kind="captions"
srclang="en"
label="English Captions">
</video>The <track> loads captions_en.vtt. The label does not affect the file content—it only names the track in the UI so users know what they are enabling.
When offering several languages, give each track a unique, readable label:
<video controls>
<source src="movie.mp4" type="video/mp4">
<track kind="captions" src="movie-en.vtt" srclang="en" label="English Captions" default>
<track kind="subtitles" src="movie-es.vtt" srclang="es" label="Español">
<track kind="subtitles" src="movie-fr.vtt" srclang="fr" label="Français">
</video>All three tracks share the same parent video but differ in label, srclang, and src. The browser uses labels as the primary display text in the track picker.
Update a track’s label when user preferences or locale change:
<video controls>
<source src="clip.mp4" type="video/mp4">
<track id="dynamicTrack" kind="captions" src="clip.vtt" srclang="en" label="English">
</video>
<script>
var trackElement = document.getElementById("dynamicTrack");
trackElement.label = "Updated Track Label";
</script>The DOM property label on HTMLTrackElement mirrors the content attribute. Changing it updates what users see without reloading the WebVTT file.
<label for="id"> element for inputs; that is unrelated to the track label attribute.Human-readable menu text.
WebVTT cues from src.
Shows each label string.
Clear names improve accessibility.
The label attribute on <track> is supported in all modern browsers alongside HTML5 media elements. Track labels appear in native caption menus in Chrome, Firefox, Safari, and Edge.
Modern browsers display label text when users choose captions or subtitles.
Bottom line: Always set clear label values on user-visible text tracks for every supported browser.
label with accurate srclang and kindlabel attribute with the <label> form elementThe label attribute within the <track> element is a valuable tool for providing descriptive names to text tracks associated with media elements. It is what users see when they choose captions, subtitles, or other synchronized text in the player.
By utilizing meaningful, unique labels alongside kind and srclang, you enhance the accessibility and user experience of your multimedia content.
labelBookmark these before adding captions to video.
Menu display name
ElementFree-form string
SyntaxUI vs language code
ComparePer track on video
Multi-trackAttribute vs element
Formslabel attribute applies to <track> elements inside <video> or <audio>. It is not used on the <label> form element.English Captions or Español. It should be human-readable and unique among tracks on the same media element.srclang is a BCP 47 language code for machines (e.g. en). label is the friendly name shown in the player menu (e.g. English Captions).trackElement.label = "Updated Track Label" on the HTMLTrackElement. Prefer setting labels in HTML when possible.<label> element labels form controls using the for attribute. The label attribute on <track> names text tracks in media players.Practice the label attribute on <track> elements and see how labels appear in the captions menu.
5 people found this page helpful