A screen filled with glowing playlist entries representing an M3U file

IPTV explained

M3U Playlists, Xtream Codes and EPG Files Explained

Three formats sit underneath almost every IPTV player ever written: the M3U playlist that lists the channels, the Xtream Codes API that serves one dynamically, and the XMLTV file that fills in the programme guide. None of them is complicated once you have seen inside, and none of them is illegal — though what people commonly load into them frequently is.

Updated

13 min read

3,029 words

The short answer

  • An M3U playlist is a plain text file listing stream URLs and channel names.
  • Xtream Codes is an API that generates a playlist on demand from a login.
  • EPG data is a separate XMLTV file, matched to channels by a tvg-id attribute.
  • The formats are neutral. The legality depends entirely on what the URLs point at.

Open any IPTV player and it will ask you for one of two things: a playlist URL, or a server address with a username and password. Those two options are the M3U format and the Xtream Codes API respectively, and between them they account for essentially the entire ecosystem of third-party IPTV software.

They are worth understanding for two quite different reasons. If you are using a legitimate free channel list, a home media server or a community-maintained public-domain playlist, knowing the format lets you edit, merge and repair it. And if you are trying to work out whether something you have been offered is above board, the structure of these files tells you a great deal.

This page explains all three formats from the inside, then covers where they sit legally — which matters, because these are exactly the files that unlicensed sellers distribute.

What an M3U IPTV playlist actually is

An M3U file is a plain text list of media locations. That is the whole specification. It began life in the late 1990s as a Winamp playlist format for MP3s and was never designed for television — the television use is a convention that grew on top of it. Players differ in how they take one: Smart IPTV uses a portal upload rather than a file you paste in. An M3U IPTV file is a plain text list, which is why an IPTV m3u can be opened in any text editor and why a broken one is usually a formatting error rather than a fault.

The simplest possible valid playlist is two lines: a header, and a URL. Real television playlists use the extended form, which adds a metadata line before each entry:

  • #EXTM3U — the header. Must be the first line, marks the file as extended M3U.
  • #EXTINF:-1 ... — a metadata line. The -1 is duration in seconds; -1 means "live, indefinite".
  • Attributes inside #EXTINF — tvg-id, tvg-name, tvg-logo, group-title. These are conventions, not part of any formal standard.
  • The display name, after a comma at the end of the #EXTINF line.
  • The stream URL on the following line.

So a single channel entry consists of exactly two lines: the #EXTINF metadata line, then the URL. A playlist with two hundred channels is four hundred lines plus the header. Nothing more sophisticated is happening.

M3U versus M3U8

This trips people up constantly, because the same extension means two different things depending on context.

Playlist .m3u / .m3u8HLS manifest .m3u8
ContainsA list of channelsA list of video segments for one stream
Written byA person, or a provider’s APIThe streaming server, continuously
LengthOne entry per channelRewritten every few seconds
You load it intoAn IPTV playerNothing — the player handles it
Typical sizeA few KB to a few MBUnder a kilobyte
Both are extended M3U files. The difference is what they list: channels, or the segments of a single stream.

Strictly, the .m3u8 extension means the file is UTF-8 encoded, while .m3u historically implied Latin-1. In practice everything modern is UTF-8 and the extensions are used interchangeably. If your channel names show as mojibake — é where é should be — you have an encoding mismatch, and saving the file as UTF-8 fixes it.

A television player interface with a channel list sidebar
A playlist is a text file. The player is what makes it television.

The IPTV m3u attributes that control how a playlist looks

Four attributes do nearly all the work in the #EXTINF line. Getting them right is the difference between a tidy, navigable channel list and an unsorted mess of four hundred entries. Get these wrong and an M3U IPTV list still plays, it just looks a mess — logos missing, everything in one group, channels out of order.

AttributeWhat it doesNotes
tvg-idLinks the channel to its programme guide entryMust match the channel id in the XMLTV file exactly, including case. The single most common source of a missing EPG.
tvg-nameThe name used for guide matching when there is no idA fallback. Less reliable than tvg-id because names vary.
tvg-logoURL of the channel logoMust be a publicly reachable image. Broken logos are almost always dead URLs or mixed HTTP/HTTPS.
group-titleThe category the channel is filed underFree text. Whatever you write becomes a folder in the player’s interface.

Two practical points come up repeatedly. First, tvg-id mismatches are responsible for the overwhelming majority of "my EPG is not working" complaints — the guide data has loaded fine, but nothing matches it to a channel. Second, group-title is entirely arbitrary, so if a playlist arrives ungrouped you can categorise it yourself in a text editor and the player will honour it.

Scales of justice silhouetted against the glow of a television
The line is drawn at licensing rights, not at the technology.

Xtream IPTV codes: a playlist generated on demand

Xtream Codes is not a file format. It is an HTTP API — originally a specific piece of panel software, now a widely cloned convention — that generates playlists dynamically from a login.

Instead of giving you a static file, the provider gives you three pieces of information: a server address, a username and a password. Your player combines them into API requests and receives back a channel list, a programme guide and stream URLs. Most players present this as an "Xtream Codes API" or "Login with details" option, distinct from "Load playlist URL".

Plain M3U playlistXtream Codes API
You supplyOne URL, or a fileServer address, username, password
Channel listFixed until the file changesFetched live each session
CategoriesFrom group-title in the fileStructured, returned by the API
On-demand contentNot supportedFilms and series with metadata
Account infoNoneExpiry date, connection limit, status
Works offlineYes, if saved locallyNo — requires the server

The API also exposes account state, which is why players using it can show you an expiry date and a maximum simultaneous connection count. A plain playlist carries none of that.

The API itself is neutral software and has entirely legitimate uses — hotel and hospitality systems, corporate internal channels, community broadcasters. But it is worth being honest that its ubiquity in the consumer market is driven by the reselling model rather than by anything technical.

A calendar and coins representing subscription term length
What each term costs once the introductory promotional rate lapses.

What is EPG on IPTV, and how the guide gets in

EPG stands for Electronic Programme Guide — the grid showing what is on now and next. On Freeview it is broadcast alongside the channels. Over IPTV it is a separate file that has to be fetched and matched, which is why it so often goes missing. Free platforms sidestep all of this: Freely and Freeview Play build the guide in.

XMLTV, the format everything uses

Guide data is distributed as XMLTV — an XML file with two kinds of element. <channel> elements declare each channel and give it an id. <programme> elements describe individual broadcasts, each carrying a start time, a stop time, and a channel attribute pointing back at a channel id.

Files are frequently gzipped, so you will see URLs ending .xml.gz. Most players handle the decompression themselves.

The matching step, which is where it breaks

The player joins the two datasets on one value: the tvg-id in your playlist must equal the channel id in the XMLTV file. If they differ by so much as a capital letter, that channel shows no guide data at all while its neighbours work perfectly.

When a guide is missing, work through these in order.

  1. Confirm the EPG source is actually loading

    Most players show a last-updated timestamp for guide data. If it is blank or stale by days, the file is not being fetched at all — check the URL and whether it needs decompressing.

  2. Compare one channel’s ids by eye

    Open the playlist in a text editor and find the tvg-id for a channel with no guide. Then search the XMLTV file for that exact string. If it is absent, you have found the problem.

  3. Check the time zone offsets

    XMLTV timestamps carry an offset, like +0000 for GMT or +0100 for BST. A guide that is correct but shifted by an hour is a time-zone handling issue, not a matching one — and in Britain it typically appears the week the clocks change.

  4. Force a refresh

    Players cache guide data aggressively. Clear the EPG cache in the app settings and reload rather than assuming a fresh fetch has happened.

How each player handles this varies quite a bit, and it is one of the clearer points of difference between them. Our comparison of IPTV players covers which apps handle awkward guide data gracefully.

A television showing an electronic programme guide grid
The guide is a separate file. That is why it goes missing on its own.

Legitimate uses for these formats

It is easy to come away thinking M3U files are inherently dubious. They are not, and there are several entirely lawful reasons to work with them. None of this makes an M3U IPTV playlist suspect in itself — the format is ordinary and widely used.

  • Public-domain and freely licensed channel lists. A number of open-source projects maintain playlists of channels that are free to stream worldwide — government broadcasters, community stations, news channels that publish open streams.
  • Home media servers. Jellyfin, Emby and Plex all accept an M3U playlist plus an XMLTV guide to provide live TV from your own sources, including a TV tuner card in your own home.
  • Your own tuner hardware. An HDHomeRun or similar network tuner attached to a rooftop aerial publishes its channels as an M3U playlist on your local network. This is you watching your own aerial over your own Wi-Fi — unambiguously fine.
  • Institutional and hospitality systems. Hotels, hospitals, schools and offices distribute internal channels this way under their own licences.
  • Digital signage. Retail and transport displays commonly pull scheduled content from a playlist.
An app icon protected behind a glowing shield
The formats are neutral. What you point them at is not.

Where the law sits

Worth stating plainly, because the formats and the offence get conflated constantly. The formats themselves are neutral — where UK law actually draws the line is about the source, and how IPTV works covers the delivery underneath. On a stick, running IPTV on a Fire TV Stick is the practical setup, and how to set IPTV up properly the full walkthrough.

Creating, editing, storing or loading an M3U file is not an offence. Neither is running player software, nor using the Xtream Codes API, nor parsing XMLTV. These are neutral technologies with substantial lawful uses, which is exactly the test that keeps a dual-use tool on the right side of the line.

What is an offence in the United Kingdom is distributing or selling access to content you have no licence to redistribute. Under section 297A of the Copyright, Designs and Patents Act 1988, supplying a playlist or a set of Xtream credentials that unlocks subscription channels is supplying an unauthorised decoder, and it carries up to ten years. The full analysis is on our page covering whether IPTV is legal in the UK.

The practical read-across is simple. If someone hands you an M3U file or a set of Xtream credentials that carries Sky Sports, they did not licence it. The file format is innocent; the contents are not.

A price comparison between streaming services and a traditional package
The comparison that matters is against your current bill, not against a rival.

Fixing a playlist that misbehaves

Assuming you are working with a playlist you are entitled to use — your own tuner, a media server, a freely licensed list — these are the problems that come up most often and what actually causes them. If the player rather than the playlist is the problem, IPTV Smarters Pro and Smart IPTV handle these files differently, and our plan list covers services that supply working details.

SymptomCauseFix
Player rejects the file entirelyMissing or misplaced #EXTM3U headerThe header must be the very first line, with no blank line or byte-order mark before it.
Channel names show as é or ’Encoding mismatchRe-save the file as UTF-8 without a BOM. Most editors offer this in Save As.
Everything lands in one giant groupMissing group-title attributesAdd group-title="News" and similar to each #EXTINF line. Any text works.
No logos anywhereDead tvg-logo URLs, or HTTP images on an HTTPS playerCheck one URL in a browser. Mixed content is blocked silently by many players.
Guide data missing on some channelstvg-id does not match the XMLTV channel idCompare the exact strings, including case. This is the top cause by a wide margin.
Channels appear but will not playStream URLs are dead, or need a referer headerTest a URL directly in VLC. If VLC fails too, the source is gone, not the playlist.
Playlist loads slowly or times outVery large file, or a slow hostSplit it, or host it locally. Files over a few megabytes strain some TV apps.

Editing safely

Because the format is plain text, any editor will do — but a few habits save time. Keep a pristine copy before you start. Edit in something that shows line endings and encoding (VS Code, Notepad++, BBEdit) rather than a word processor, which will silently insert smart quotes and break attribute parsing. And change one thing at a time, reloading between edits, because a single malformed #EXTINF line can make a player reject everything after it.

Which player you end up using makes a real difference to how much of this you have to think about — some handle malformed attributes gracefully while others simply refuse. Our comparison of IPTV players and apps covers how each one behaves, and IPTV Smarters Pro in particular is worth reading on for its buffer and decoder settings, which resolve most playback complaints.

A laptop showing a playlist file being corrected
Most playlist faults are one malformed line, not a broken service.

Frequently asked questions

What is the difference between an m3u file and an m3u8 file?

Encoding, mostly. An m3u8 file is the same playlist format saved as UTF-8, which matters once channel names use characters outside plain ASCII. Players treat them identically, and an IPTV m3u with the wrong encoding is a common cause of garbled channel names.

What is EPG on IPTV, and do I need one?

EPG is the electronic programme guide — a separate XML file listing what is on and when. It is optional: a playlist works without one, but you get a bare channel list with no schedule. Most providers supply an EPG URL alongside the playlist.

How do Xtream IPTV codes differ from a plain playlist?

A plain M3U is a static file you paste in. Xtream Codes gives the player a username, password and server address, and the playlist is generated on demand — so channel changes appear without you re-importing anything.

What is an M3U playlist?

A plain text file listing media locations. For television it begins with #EXTM3U, then for each channel carries an #EXTINF metadata line — holding the channel name, logo, category and guide id — followed by the stream URL on the next line. It is a list of pointers, not video.

What is the difference between M3U and M3U8?

Strictly, .m3u8 signals UTF-8 encoding while .m3u historically implied Latin-1, and in practice they are interchangeable. More importantly, the same .m3u8 extension is also used for HLS manifests, which list the segments of a single stream rather than a list of channels — a completely different job.

What is Xtream Codes?

An HTTP API that generates a channel list on demand from a server address, username and password, rather than serving a fixed file. It returns structured categories, on-demand catalogues and account details such as expiry date and connection limits, none of which a plain playlist can carry.

What does EPG mean on IPTV?

Electronic Programme Guide — the now-and-next grid. On IPTV it comes from a separate XMLTV file that your player fetches and matches to your channels using the tvg-id attribute. It is not embedded in the stream the way it is on Freeview.

Why is my IPTV EPG not showing?

Nearly always a tvg-id mismatch: the id in your playlist does not exactly match the channel id in the XMLTV file, including capitalisation. Other causes are an EPG URL that is not loading at all, a stale cache, or a time-zone offset shifting everything by an hour.

Are M3U playlists illegal?

No. The format is neutral and has substantial lawful uses — home media servers, network TV tuners, freely licensed public channel lists, hospitality systems. What can be illegal is the content the URLs point at. Distributing a playlist that unlocks subscription channels without a licence is an offence under section 297A of the CDPA 1988.

Can I edit an M3U file myself?

Yes — it is plain text, so any text editor will open it. You can rename channels, reorder them, fix logo URLs and change group-title values to re-categorise the list. Save as UTF-8 to avoid corrupting accented characters.

Written by

Priya Raman

Priya writes the setup and troubleshooting guides. She tests every walkthrough on real hardware — a Fire TV Stick 4K Max, a Sky Stream puck and a Humax Freely box — before it goes live.

How we test and rate