What is MIME type "video/webm"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

The MIME type video/webm is used for web video files that work directly in browsers.
It delivers compressed video and audio streams for efficient, high-quality playback.
Files that use this MIME type typically have the WEBM extension.
For further technical details, see the documentation on the MDN Web Docs or visit the Wikipedia page on WebM.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: video/webm    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="video/webm">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'video/webm');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

How do I use video/webm in an HTML5 video tag?

You should use the <source> element within a <video> tag to specify the file and its MIME type. For example: <source src="movie.webm" type="video/webm">. It is best practice to include a fallback format, such as video/mp4, to ensure compatibility across all devices and browsers.

How do I configure my web server to serve WebM files correctly?

For Apache servers, add the line AddType video/webm .webm to your .htaccess or configuration file. For Nginx, ensure your mime.types file includes video/webm webm;. If the server sends the wrong MIME type, browsers may attempt to download the file instead of playing it.

Does Safari on iOS and macOS support video/webm?

Yes, modern versions of Safari (macOS Big Sur and later, iOS 15 and later) support video/webm playback. However, older versions of Safari did not support the format natively. To maximize reach, developers often provide both a WebM version and an MP4 version in the video stack.

What is the difference between video/webm and video/mp4?

WebM is an open, royalty-free media file format designed specifically for the web, utilizing VP8/VP9 video codecs and Vorbis/Opus audio. MP4 (H.264) is widely supported by hardware but involves patent royalties. WebM often produces smaller file sizes for similar quality, making it ideal for web backgrounds and animations.

Does video/webm support transparency (alpha channels)?

Yes, one of the distinct advantages of video/webm is its support for alpha transparency when using the VP8 or VP9 codecs. This allows developers to create video elements with transparent backgrounds that overlay on top of other HTML content, which is not natively supported by standard H.264 MP4 files.

Why is my WebM video downloading instead of playing in the browser?

This usually happens because the server is sending the wrong Content-Type header, such as application/octet-stream or text/plain. You must configure your server to explicitly send the video/webm MIME type for files with the .webm extension.

How can I convert a video to the WebM format?

You can use the command-line tool FFmpeg with a command like ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 1M output.webm. Alternatively, many video editing software packages (like Adobe Premiere) and online converters support exporting directly to the .webm format.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.