HTML default Attribute

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The default attribute is a boolean on <track>. It marks which text track (subtitles, captions, and similar) should be enabled when the user has not picked another track.

Put <track> inside <video> or <audio>, with kind, src (a WebVTT .vtt file), and usually srclang and label.

Baseline · Widely available.

Not deprecated and not experimental. Stable with HTML5 media and <track> across modern browsers.

Not a form attribute.

Do not use default on inputs. Use value, checked, or selected instead.

HTML Syntax

syntax.html
<track  default kind="captions" src="file.vtt">

Boolean: write default alone (or default="default"). Use it on only one <track> per media element.

Attribute Values

Boolean only — presence turns the track into the default:

ValueDescriptionTry it
default (present)Enable this track unless user preferences choose anotherTry it
default="default"Same boolean, XHTML-style spellingTry it
Attribute omittedTrack stays available in the menu but is not auto-enabledTry it
track.default (JS)Read or set the boolean on HTMLTrackElementTry it

Live Preview

Choose which subtitle track has default. Play the video and open the CC / subtitles menu if cues are hidden.

Only one track should have default at a time.

video + track

English.default = true · Español.default = false

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Default Captions Track

Enable English captions automatically for accessibility.

HTML
<video controls width="400">
  <source src="flower.webm" type="video/webm">
  <track
    default
    kind="captions"
    srclang="en"
    label="English"
    src="captions-en.vtt">
  Your browser does not support HTML video.
</video>
Try It Yourself

How It Works

  1. Nest track under video (or audio).
  2. default asks the browser to enable this track first.
  3. kind="captions" marks closed captions (dialog + sounds).
  4. src points to a WebVTT file with the timed cues.

Example 2 — Several Languages, One Default

Offer multiple subtitle tracks; mark only one with default.

HTML
<video controls width="400">
  <source src="flower.webm" type="video/webm">
  <track kind="subtitles" srclang="en" label="English"
    src="subs-en.vtt" default>
  <track kind="subtitles" srclang="es" label="Español"
    src="subs-es.vtt">
  Your browser does not support HTML video.
</video>
Try It Yourself

How It Works

  1. List every language as its own <track>.
  2. Put default on one only (English here).
  3. label is what users see in the player menu.
  4. Users can still switch to Español (or Off) in the UI.

Example 3 — Toggle default in JavaScript

Use the default property on HTMLTrackElement.

HTML
<video id="v" controls width="400">
  <source src="flower.webm" type="video/webm">
  <track id="en" kind="subtitles" srclang="en" label="English"
    src="subs-en.vtt" default>
  <track id="es" kind="subtitles" srclang="es" label="Español"
    src="subs-es.vtt">
</video>
<button type="button" id="btn">Make Español default</button>

<script>
  document.getElementById("btn").addEventListener("click", function () {
    document.getElementById("en").default = false;
    document.getElementById("es").default = true;
  });
</script>
Try It Yourself

How It Works

  1. Give each track an id so scripts can find them.
  2. Set default = true on the track you want.
  3. Clear the other with default = false so only one stays default.
  4. Reload or re-select captions in some browsers if the active cue does not update immediately.

Edge Cases & Pitfalls

Most mistakes come from treating default like a form attribute or stacking several defaults.

scope

Only one default per media element

Do not put default on multiple <track> children of the same video/audio.

forms

Not for inputs or options

Use selected / checked / value for form defaults — never default.

vtt

Same-origin WebVTT

src must be same-origin unless the media element uses CORS (crossorigin). Broken VTT = no cues.

a11y

Prefer captions when needed

For deaf or hard-of-hearing users, kind="captions" (dialog + sounds) is usually better than plain subtitles.

prefs

User settings can win

default applies unless preferences say another track is more appropriate — do not fight the user’s caption language settings.

Browser Support

default is an HTML attribute on track inside video/audio. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

default

Widely available with HTML5 track support (since about July 2015). Captions UI differs by browser, but the attribute itself is reliable.

96% Global support (approx.)
Google Chrome 23+
Full support
Mozilla Firefox 31+
Full support
Apple Safari 6+
Full support
Microsoft Edge 12+
Full support
Opera 12.1+
Full support
Samsung Internet Modern
Full support
Internet Explorer 10+
Supported
default Widely supported

Bottom line: Safe to use for default captions/subtitles. Always provide real .vtt files and test the player’s CC menu on your target browsers.

Key Takeaways

  • Role: mark the default text track on <track>.
  • Limit: only one default per video/audio.
  • JS: use HTMLTrackElement.default (boolean).
  • Not for forms: use selected / checked / value there.

One line: default on <track> picks which captions/subtitles start on — one per player.

Frequently Asked Questions

On a track element, default is a boolean that marks the text track to enable when the user has not chosen another track. It is used for subtitles, captions, and other timed text on video or audio.
Only the track element, as a child of video or audio. It is not a form attribute.
No. For forms use value on inputs, checked on checkboxes/radios, and selected on option. The default attribute is for track only.
MDN and the HTML living standard: use default on only one track element per media element. Extra defaults are invalid.
Use the boolean HTMLTrackElement.default property, for example trackEl.default = true. Prefer only one track with default true at a time.
No. The track is enabled unless the user’s preferences indicate that another track is more appropriate.

Next: defer

Load scripts after HTML parsing with the defer attribute.

defer tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful