Codectionary / Developer documentation / HTML

<track>

The <track> element specifies timed text tracks for <video> or <audio> elements — most commonly subtitles or captions in WebVTT format. Multiple tracks can be provided for different languages, and the default attribute marks which one should be enabled automatically.

Syntax

<track src="captions.vtt" kind="subtitles" srclang="en" label="English">

Examples

Basic Captions

Adding English captions to a video.

<video controls>
  <source src="tutorial.mp4" type="video/mp4">
  <track src="captions-en.vtt" kind="captions" srclang="en" label="English" default>
</video>

Multiple Language Subtitles

Offering subtitle tracks in more than one language.

<video controls>
  <source src="movie.mp4" type="video/mp4">
  <track src="subs-en.vtt" kind="subtitles" srclang="en" label="English" default>
  <track src="subs-fr.vtt" kind="subtitles" srclang="fr" label="Français">
</video>

Chapter Markers

Using track for chapter navigation instead of captions.

<video controls>
  <source src="lecture.mp4" type="video/mp4">
  <track src="chapters.vtt" kind="chapters" srclang="en" label="Chapters">
</video>

Attributes

  • src (URL): The URL of the WebVTT track file
  • kind (subtitles | captions | chapters | descriptions): The type of timed text
  • srclang (string): The language of the track content, as a language code
  • label (string): A human-readable label shown in the track selection menu
  • default (boolean): Marks this track as enabled by default

Best practices

  • Always provide captions for video content with spoken dialogue — it is one of the most impactful accessibility improvements you can make
  • Use kind="captions" (which includes non-speech sounds) rather than kind="subtitles" when the audience may be deaf or hard of hearing, not just non-native speakers
  • Mark exactly one track as default per kind to avoid ambiguity
  • Test that your WebVTT files are valid — malformed timing syntax will silently fail to display

At a glance

Purpose
Structure and meaning for web content
File extension
.html · .htm
Runs in
Web browsers
Usually used with
CSS and JavaScript

Specifications & further reading

Related HTML documentation