Introduction
WebVTT, the Web Video Text Tracks format, is the subtitle and caption format of the
web, specified by the W3C. A web page attaches a .vtt file to a video with
the HTML <track> element, and the browser shows the cues at the right
times. HLS streams also carry their subtitles as WebVTT.
WebVTT grew out of SRT and looks much like it, but it has a proper specification. It is always UTF-8, and it adds cue positioning, speaker names, styling with CSS and comments.
WebVTT can also be carried inside an MP4 file, which is a separate format: WebVTT in MP4.
Structure
The full reference:
- File structure – the header, the blocks, the kinds of file, the HLS timestamp map
- Cues and settings – timestamps, the timing line and every cue setting
- Cue text – tags, classes, karaoke timestamps and character references
- Regions – the
REGIONblock and roll-up captions - Styling with CSS –
::cue,::cue-regionand the properties that apply
The file must begin with the word WEBVTT, optionally followed by a space
and a title on the same line. After a blank line come blocks separated by blank lines.
Most blocks are cues: an optional identifier line, a timing line, then the text. Times
are written hours:minutes:seconds.milliseconds with a full stop, and the
hours can be left out. Settings after the times, such as line,
position, size and align, place the cue on
screen.
The text can use the tags <b>, <i>,
<u>, <v Speaker> for the voice speaking, and
<c.class> for CSS styling. Other blocks are NOTE for
comments, STYLE for CSS and REGION for named areas of the
screen.
WEBVTT
NOTE The opening scene
intro-1
00:01.000 --> 00:03.500 line:85%
<v Anna>Where are we going?
00:04.000 --> 00:06.250
<v Ben><i>Somewhere we have never been.</i>
Not described
The pages follow the W3C WebVTT specification (the editor’s source, index.bs in github.com/w3c/webvtt, and the Candidate Recommendation), and RFC 8216 section 3.5 and Apple’s draft-pantos-hls-rfc8216bis section 3.1.4 for WebVTT segments in HLS, and the W3C Working Draft of 8 December 2015 for the older header grammar, read 2026-11-14 and 2026-11-19. WebVTT carried in MP4 (ISO/IEC 14496-30) is a separate format, described on WebVTT in MP4. Covered: the HLS segment rules, the older header grammar, the cue size cap, line rounding, the default colour classes with their rgba values, line units and offsets, the automatic position rule, base direction, regions without scroll, clipping and the cue-text recovery rules.
Known, not yet covered
- Reference: the full rendering algorithm (box layout, the overlap-avoidance moves and region sizing): only its results are described. This is display behaviour and is held for the owner’s ruling; the parts that decide how file values are read are listed below as NEW.
- Viewer: the explorer reads a
.vttfile as the W3C parser algorithm does and shows the signature, the header block (with the HLSX-TIMESTAMP-MAPline decoded), every block (cues with identifier, timings, decoded settings and the cue text as the parser’s node tree;NOTE,STYLE,REGION, and the blocks the parser drops, with the reason), a cue list and a problem list, each problem labelled a syntax error, a parser recovery or a warning. Still missing: it does not parse or check the CSS of aSTYLEblock (it shows it as coloured text, in line-aligned windows of about a million characters when the STYLE text is longer, so all of it can be read); it checks that alangannotation is a well-formed BCP 47 language tag (the syntax of RFC 5646 section 2.1, including the grandfathered tags) but not that it is a registered one; it does not draw the cues on a video frame or run the rendering algorithm; and a file is judged a chapters file by a stated rule (plain one-line cue text, no settings, and one cue inside another or “chapter” in the file name), so a chapters file that follows none of those is read as ordinary cues and its cues are not checked for nesting.
Unknown
- Reference: other
X-header lines in use besidesX-TIMESTAMP-MAP: no public source found.
Links
Software
- Firefox – web browser that shows WebVTT through the
<track>element (Windows, macOS, Linux, mobile) - Chrome – web browser that shows WebVTT through the
<track>element (Windows, macOS, Linux, mobile) - Subtitle Edit – free subtitle editor that opens, edits and converts WebVTT (Windows, Linux)
- VLC media player – free media player that loads WebVTT next to the video (Windows, macOS, Linux, mobile)
- mpv – free, minimal media player that reads WebVTT (Windows, macOS, Linux)
- FFmpeg – command-line tools that read, write and convert WebVTT (Windows, macOS, Linux)
Developers
- webvtt-py – reads, writes and converts WebVTT (Python)
Reference
- WebVTT: The Web Video Text Tracks Format – the W3C specification
- WebVTT API – MDN Web Docs’ guide to the format and its use in browsers