Glossary entry · File format
M3U8 (HLS Playlist File)
A UTF-8 encoded plain-text playlist file. M3U8 is the manifest format that holds HLS together, listing segment URLs, durations, and stream metadata.
Definition
An M3U8 file is a UTF-8 encoded plain-text playlist. Each line is either a directive (a line that starts with #EXT) or a URI pointing to a piece of media. The first line of any valid HLS playlist is the literal string #EXTM3U. Everything else is optional in principle, but well-formed HLS playlists carry enough metadata to feed an adaptive streaming player without further out-of-band information.
The "M3U" part comes from the Winamp-era playlist format named after MPEG audio layer 3. The trailing "8" indicates UTF-8 encoding, which became necessary once playlists started referencing internationalized URLs and subtitle metadata. The format is documented in RFC 8216.
Master playlist vs media playlist
HLS uses M3U8 in two different roles, and the distinction matters when you debug a stream.
A master playlist lists the available quality variants. Each entry pairs an EXT-X-STREAM-INF tag with the URL of a media playlist. The master playlist is what a player loads first to discover what bitrates exist.
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-STREAM-INF:BANDWIDTH=540000,RESOLUTION=640x360
360p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1500000,RESOLUTION=1280x720
720p/index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=4500000,RESOLUTION=1920x1080
1080p/index.m3u8
A media playlist lists actual segment URLs. This is the file a player downloads after picking a variant, and the file that ffmpeg or yt-dlp will fetch when given an M3U8 URL.
#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:5.96,
seg-0001.ts
#EXTINF:6.00,
seg-0002.ts
#EXT-X-ENDLIST
If you save a master playlist and try to play it without the media playlists, the player will appear to do nothing because there are no segments to fetch. This is the most common confusion when you grab an M3U8 URL from DevTools.
Tags you will find inside
HLS defines dozens of tags but a handful do almost all of the work. Knowing them turns an M3U8 file from cryptic ASCII soup into a readable spec.
#EXTM3U: mandatory first line. Marks the file as an extended M3U playlist.#EXT-X-VERSION: protocol version (typically 3 through 9). Higher versions unlock fMP4 segments, byte-range requests, and other modern features.#EXT-X-TARGETDURATION: upper bound on individual segment durations in seconds. Players use this to size their initial buffer.#EXT-X-MEDIA-SEQUENCE: index of the first segment in the playlist. Critical for live streams where the playlist is a sliding window.#EXTINF: precedes every segment URL with the segment's exact duration in seconds.#EXT-X-KEY: declares that the following segments are encrypted, with the URI of the key file. See the AES-128 glossary entry for the full mechanics.#EXT-X-STREAM-INF: only in master playlists. Declares a variant stream with its bandwidth, resolution, and codec list.#EXT-X-MEDIA: only in master playlists. Declares an alternative audio or subtitle track.#EXT-X-ENDLIST: marks a VOD playlist. Absence indicates a live stream the player should keep polling.#EXT-X-BYTERANGE: allows segments to be byte ranges of a single underlying file, common with fMP4.#EXT-X-MAP: points to the initialization segment (the moov box) for fMP4 streams.
How to open an M3U8 file
Double-clicking an M3U8 file rarely does anything useful. The file is a text manifest, not a video. To play it you need an HLS-aware player that will read the playlist and fetch segments. The realistic options are:
- VLC: File → Open Network, paste the URL. Works on every desktop OS.
- mpv:
mpv playlist.m3u8on the command line. - Safari: paste the URL into the address bar. Safari is the only browser with native HLS playback.
- hls.js: drop the playlist into any web page that uses the open-source hls.js library to feed video to the standard HTML5 video element.
If the playlist is a master playlist with relative URLs, you must serve it from the original host (or rewrite the URLs to absolute) or the player will fail to load the media playlists.
Why an M3U8 alone is not a playable video
An M3U8 file weighs a few kilobytes. The actual video can be hundreds of megabytes. The playlist only carries pointers, not pixels. When you right-click "Save as" on a streaming page, you almost always save the M3U8 text file rather than the video. That is why naive saving fails.
The clean way to "save an M3U8 video" is to fetch every segment listed in the playlist, optionally decrypt them with the AES-128 key referenced by EXT-X-KEY, and mux them into a single MP4 container. We walk through the complete conversion pipeline in our practical guide on converting M3U8 to MP4 and on finding the M3U8 URL of any page.
If you want a one-click solution that handles segment fetching, AES-128 decryption, and muxing in the browser, our dedicated M3U8 detector and M3U8 to MP4 converter tools cover both halves of the workflow without leaving the browser.