.vtt MIME type
WebVTT subtitlestext & code
text/vttCaptions and subtitles for HTML <track> elements.
| MIME type | text/vtt |
|---|---|
| Extensions | .vtt |
| Content-Type | text/vtt; charset=utf-8 |
| Compress in transit? | Yes — enable gzip or Brotli |
Good to know
- Browsers ignore a
<track>file served with the wrong type. - Cross-origin caption files need CORS headers and
crossoriginon the<video>element.
Serve .vtt files with the right type
The response header to send:
Content-Type: text/vtt; charset=utf-8
Most servers pick the type from the file extension. If yours sends the wrong one, map it explicitly:
nginx (inside the types block in mime.types)
text/vtt vtt;
Apache (.htaccess or server config)
AddType text/vtt .vtt
Express
res.set("Content-Type", "text/vtt; charset=utf-8");Python
import mimetypes
mimetypes.add_type("text/vtt", ".vtt")HTML file input
<input type="file" accept=".vtt,text/vtt">
Check it
See what a server sends for a file, and what type a local file really is by its contents:
curl -sI https://example.com/file.vtt | grep -i '^content-type:' file --mime-type file.vtt
Frequently asked questions
What is the MIME type for .vtt files?
text/vtt.
What Content-Type header should a .vtt file be served with?
Content-Type: text/vtt; charset=utf-8. As a text format, include the charset so browsers don't guess the encoding. It compresses well, so let the server apply gzip or Brotli.
Related types
Headers that go with it: Content-Type · Content-Disposition · X-Content-Type-Options