video/webm MIME Type — WebM vs MP4, Browser Support & Examples
WebM is an open, royalty-free video format based on the Matroska container with VP8/VP9/AV1 video and Vorbis/Opus audio. Supported by all modern browsers. Often used alongside MP4 in <source> elements for maximum compatibility.
Used For
- Web video with royalty-free codec (VP9/AV1)
- Screen recordings
- Alternative to MP4 for open-source projects
HTTP Header Example
HTTP/1.1 200 OK
Content-Type: video/webm
Accept-Ranges: bytesCode Examples
// HTML — serve WebM with MP4 fallback
<video controls width="640" height="360">
<source src="/video.webm" type="video/webm" />
<source src="/video.mp4" type="video/mp4" />
Your browser does not support HTML5 video.
</video>
// Express
app.get('/video.webm', (req, res) => {
res
.set('Content-Type', 'video/webm')
.set('Accept-Ranges', 'bytes')
.sendFile('./videos/video.webm', { root: process.cwd() })
})Related MIME Types
Frequently Asked Questions
What is the video/webm MIME type?
WebM is an open, royalty-free video format based on the Matroska container with VP8/VP9/AV1 video and Vorbis/Opus audio. Supported by all modern browsers. Often used alongside MP4 in <source> elements for maximum compatibility.
When should I set Content-Type: video/webm?
Set Content-Type: video/webm on HTTP responses that contain WebM Video data. Web video with royalty-free codec (VP9/AV1).
What file extensions use video/webm?
Files with video/webm content typically use these extensions: .webm.
What happens if I serve this with the wrong Content-Type?
Browsers use the Content-Type header to decide how to handle the response. Serving video/webm content with an incorrect MIME type can cause browsers to display it incorrectly, refuse to execute it (scripts), or prompt an unintended download. Modern browsers respect X-Content-Type-Options: nosniff and will not attempt to auto-detect the type.
