MP4, MKV, WebM and HLS: Video Formats Explained
Published 7 October 2026 · All guides
Two videos can both end in .mp4 and behave completely differently:
one plays instantly in any browser, the other shows a black screen. The reason is that a video
file is really two things — a container and the codecs inside it. Once that distinction is
clear, most format puzzles solve themselves.
Containers and codecs
A container is the box. It holds the video track, one or more audio tracks, subtitles and information such as the duration and chapter marks. MP4, MKV, WebM and MOV are containers. The file extension tells you the container.
A codec is the method used to compress what is inside the box. H.264, H.265 (HEVC), VP9 and AV1 are video codecs; AAC, MP3, Opus and AC-3 are audio codecs. The codec decides how good the picture looks at a given file size, and — crucially — whether your device can decode it.
An analogy: the container is the envelope, the codec is the language the letter is written in. You can open any envelope, but you can only read the letter if you know the language.
The common containers
MP4
The most widely supported container. MP4 with H.264 video and AAC audio plays in essentially every browser, phone, smart TV and editing program made in the last decade. If you want a video to "just work" for whoever receives it, this is the combination to use.
MKV (Matroska)
A flexible open container popular for films and recordings because it can hold many audio and subtitle tracks. Desktop players handle MKV well, but browsers generally do not play it directly, so an MKV file usually has to be downloaded and opened in an app such as VLC.
WebM
A container designed for the web, normally carrying VP9 or AV1 video with Opus audio. Chrome, Firefox and Edge play it natively; support on older Apple devices is more limited.
MOV
Apple's container, common for video recorded on iPhones. Often it holds H.264 or HEVC, so whether it plays depends on the codec more than the container.
The common codecs
- H.264 (AVC) — the universal choice. Supported almost everywhere, with hardware decoding even on cheap phones.
- H.265 (HEVC) — roughly half the file size of H.264 for similar quality, and the default on many recent phones. Browser support is patchy, which is the single most common reason a phone video will not play on a web page.
- VP9 — Google's royalty-free codec, used widely on the web.
- AV1 — the newest open codec, very efficient but demanding to decode on older hardware.
What about HLS and adaptive streaming?
HLS (HTTP Live Streaming) is not a file format in the usual sense. Instead of one large file, the video is cut into short segments, often a few seconds each, at several quality levels. A small playlist file tells the player where the segments are. The player can switch between qualities as your connection speeds up or slows down, which is why streaming services rarely stop to buffer. DASH works the same way. When a provider offers an HLS version of a video, it is usually the smoothest option on an unreliable connection.
Why a file plays in VLC but not in the browser
Browsers deliberately support a small set of codecs, chosen for licensing and security reasons. Desktop players like VLC bundle decoders for hundreds of formats. So when a video refuses to play in a browser, downloading it and opening it in VLC almost always works. If you need it to play in the browser, convert it to MP4 with H.264 and AAC using a free tool such as HandBrake.
Choosing a format for your own uploads
- For maximum compatibility: MP4, H.264 video, AAC audio.
- For smaller files when everyone has modern devices: MP4 with HEVC, accepting that some browsers will not play it.
- For archiving with multiple audio or subtitle tracks: MKV, opened in a desktop player.
Getting the format right before you upload saves everyone you share with from the black-screen problem described in our playback troubleshooting checklist.