DevToolsmith

VTT MIME Type

text/vtt is the MIME type for WebVTT subtitles and captions. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
text/vtt
Extensions
.vtt
Content-Type header
text/vtt; charset=utf-8
Registered
Yes, with IANA
Compress with gzip
Yes, it is text or uncompressed
Category
Web

About WebVTT subtitles files

The subtitle format for <track> in HTML video. Browsers ignore a track served with any other type, with no visible error. Files must start with WEBVTT; SubRip (.srt) subtitles look similar but use commas in timestamps and need converting first.

File signature

VTT files start with "WEBVTT" (after an optional BOM). The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .vtt with the right Content-Type

Response header
Content-Type: text/vtt; charset=utf-8
nginx (a line in the types { } block of mime.types)
text/vtt vtt;
Apache (.htaccess or server config)
AddType text/vtt .vtt
AddCharset UTF-8 .vtt
Caddy
@vtt path *.vtt
header @vtt Content-Type "text/vtt; charset=utf-8"
Check what a server sends
curl -sI https://example.com/file.vtt | grep -i '^content-type'
# Content-Type: text/vtt; charset=utf-8

Set the type in code

Node.js (Express)
res.set('Content-Type', 'text/vtt; charset=utf-8');
Python
import mimetypes

mimetypes.add_type('text/vtt', '.vtt')  # if your system doesn't know it
mimetypes.guess_type('file.vtt')[0]  # 'text/vtt'
Go
mime.AddExtensionType(".vtt", "text/vtt; charset=utf-8")
w.Header().Set("Content-Type", "text/vtt; charset=utf-8")

Accept .vtt uploads

HTML
<input type="file" accept=".vtt,text/vtt">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .mp4 (video/mp4): MP4 video
  • .webm (video/webm): WebM video
  • .m3u8 (application/vnd.apple.mpegurl): HLS playlist

More web

.html , .css , .js , .mjs , .svg , .wasm , .webmanifest , .rss . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .vtt files?

text/vtt. It is a text format, so add the character set: "Content-Type: text/vtt; charset=utf-8".

Why does my server send the wrong Content-Type for .vtt?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .vtt is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is VTT?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. VTT files start with "WEBVTT" (after an optional BOM). The MIME type lookup on this site reads them for you when you drop a file on it.