Everything you need to know about WEBM
WebM (.webm) is an open, royalty-free video container format developed by Google in 2010 specifically for HTML5 video on the web. It uses Matroska as its container with VP8/VP9 video and Vorbis/Opus audio - all unencumbered by patent licensing.
How it works under the hood
- Royalty-free codecs. Unlike H.264 (which technically requires MPEG-LA patent licensing), VP9 has zero licensing fees. This is why YouTube, Netflix, and Twitch use WebM heavily for streaming.
- VP9 vs H.264. VP9 produces ~30-50% smaller files at equivalent quality. The trade-off is encoding time (VP9 is 5-10x slower) and CPU cost on playback.
- Matroska heritage. The container supports unlimited tracks, attached files, chapters, and 16-byte UUIDs for tracks. Far more flexible than MP4's atom structure.
- No Safari support... yet. Apple resisted WebM for years. Safari 14.1+ (2021) finally added VP9 decoding, but only when hardware-accelerated.
Where you'll actually use it
- HTML5 video where licensing matters (open-source projects, educational sites)
- Adaptive streaming where bandwidth costs are critical (VP9 saves ~30% over H.264)
- Animated graphics and short loops (replaces GIF with 95% smaller files)
- WebRTC video calls (the spec mandates VP8/VP9)
How it compares to alternatives
WebM vs MP4: WebM wins on file size and licensing; MP4 wins on universal compatibility (especially Safari < 14). Best practice: serve both via `<video><source src='video.webm'><source src='video.mp4'></video>` and let the browser pick.
Things that will trip you up
- Some older Smart TVs and embedded browsers don't support WebM - always provide an MP4 fallback for production sites
- VP9 encoding is dramatically slower than H.264 - budget 10x the encoding time for batch jobs
- iOS Safari only added VP9 in 14.1 (April 2021); for older iOS you still need H.264 MP4