2026-07-036 min readm3u8 file structure, m3u8 format explained, m3u8 tags reference

M3U8 File Format: Structure and Key Tags Explained

Deep dive into the M3U8 file format. Every tag and attribute in the HLS playlist specification explained with examples.

M3U8 File Structure Overview

An M3U8 file has a simple line-by-line structure. Each line is either a tag (starts with #) or a URI (a path or URL to a segment or another playlist). The structure varies depending on whether it's a master playlist or a media playlist.

Master Playlist Structure

A master playlist contains references to multiple variant streams:

#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=1280000,RESOLUTION=720x480,CODECS="avc1.66.30,mp4a.40.2"
medium.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2560000,RESOLUTION=1280x720,CODECS="avc1.77.30,mp4a.40.2"
high.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=5120000,RESOLUTION=1920x1080,CODECS="avc1.77.30,mp4a.40.2"
fullhd.m3u8

Media Playlist Structure

A media playlist contains the actual segment references:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:10.000,
seg-0.ts
#EXTINF:10.000,
seg-1.ts
#EXTINF:10.000,
seg-2.ts
#EXT-X-ENDLIST

Essential Tags Reference

TagPurposeRequired
#EXTM3UFile header (must be first line)
#EXT-X-VERSIONProtocol version number
#EXT-X-TARGETDURATIONMaximum segment duration
#EXTINFSegment duration and title
#EXT-X-MEDIA-SEQUENCEFirst segment number⚠️
#EXT-X-KEYEncryption key info⚠️
#EXT-X-STREAM-INFVariant stream description⚠️
#EXT-X-ENDLISTSignals end of VOD⚠️

Common Errors in M3U8 Files

  • Missing #EXTM3U header — The file won't be recognized as a valid playlist
  • Incorrect segment paths — Relative paths may break if the playlist URL changes
  • Mismatched target duration — If a segment exceeds TARGETDURATION, players may misbehave
  • Missing ENDLIST for VOD — Players will keep waiting for new segments indefinitely
  • Encoding errors — Files must be UTF-8 (or ASCII for basic M3U)

Related Articles