Skip to content

Convert M3U to XML

Convert M3U playlist paths and metadata into XML for a schema-compatible media application.

Convert M3U files online

We don’t have a dedicated online converter for M3U to XML yet, but you can convert M3U files online to these formats:

Want to convert M3U to XML?

Let us know. We pick the conversions to add next by how many people ask for them.

How to convert m3u to xml file

Some media players, IPTV clients, and cataloging systems accept XML playlists but not M3U files exported by VLC, foobar2000, or other playlist managers. Conversion is also useful when playlist metadata must be edited, archived, or imported into software that requires a defined XML schema.

What the M3U format is

M3U is a plain-text playlist format containing local paths, relative paths, network shares, or streaming URLs. A basic file contains one media location per line; an extended playlist begins with #EXTM3U and commonly places a #EXTINF line before each location to specify duration and display title.

VLC, Winamp, foobar2000, Kodi, IPTV clients, and media-library tools commonly create or read M3U files. .m3u8 uses the same general playlist syntax with UTF-8 text encoding. M3U stores references and optional metadata; it does not contain or convert the audio or video itself.

What the XML format is

XML stores hierarchical data with named elements, attributes, text, escaping rules, and optional namespaces. Its structured fields make playlist records easier to validate, edit, archive, or import into databases and cataloging systems.

XML has no universal playlist structure. One application might require <track uri="...">, while another expects elements such as <media>, <location>, and a specific namespace. A file can therefore be valid XML and still be unusable by the destination program.

Convert with a Python script

For a repeatable conversion, use Python 3 and adapt the output names to the receiving application's schema. Save the following as m3u_to_xml.py in Notepad++, VS Code, or another plain-text editor:

from pathlib import Path
import sys
import xml.etree.ElementTree as ET

source = Path(sys.argv[1])
destination = Path(sys.argv[2])
root = ET.Element('playlist')
duration = None
title = None

for raw_line in source.read_text(encoding='utf-8-sig', errors='replace').splitlines():
    line = raw_line.strip()
    if not line or line == '#EXTM3U':
        continue
    if line.startswith('#EXTINF:'):
        value = line[8:]
        fields = value.split(',', 1)
        duration = fields[0].strip()
        title = fields[1].strip() if len(fields) == 2 else ''
    elif not line.startswith('#'):
        track = ET.SubElement(root, 'track', {'uri': line})
        if duration not in (None, ''):
            track.set('duration', duration)
        if title:
            ET.SubElement(track, 'title').text = title
        duration = None
        title = None

ET.indent(root, space='  ')
ET.ElementTree(root).write(destination, encoding='utf-8', xml_declaration=True)

Run it from a terminal in the folder containing the script:

python m3u_to_xml.py playlist.m3u playlist.xml

Use python3 instead of python on systems configured with that command. The script creates XML like <playlist> containing <track uri="..." duration="..."> and an optional <title> element. Change playlist, track, uri, duration, and title to the exact names required by the destination specification.

Before importing, compare the output's root element, child elements, attributes, namespaces, and required fields with the target application's documentation. Do not paste M3U text into a new file and rename it; changing the extension does not create XML, and raw M3U lines are not valid XML structure.

Use a media player or online service

VLC can save playlists through Media → Save Playlist to File. Its XML playlist output is generally XSPF, an XML-based playlist format, rather than arbitrary XML matching a program-specific schema. Use XSPF only when the receiving application explicitly supports it.

For a small, non-sensitive playlist, check reputable services such as Zamzar or Convertio and confirm that their current format selector lists M3U as the input and XML as the output. These services may only rename or produce a generic result, and they cannot infer an application's private XML schema. Do not upload playlists containing confidential local paths, authenticated URLs, private network addresses, or stream tokens.

A text editor such as Notepad++ is suitable for inspecting and manually editing the result when the required XML schema is known, but it is not an automatic converter. For repeated conversions or custom IPTV metadata, a script or a dedicated importer is more reliable than manual editing.

Quality and compatibility limits

The conversion preserves locations and only the metadata explicitly mapped by the converter. Directives such as #EXTVLCOPT, #KODIPROP, IPTV group attributes, logos, codecs, and custom tags are discarded by the sample script unless additional parsing is implemented.

Use UTF-8 output for non-ASCII titles. The XML library escapes characters such as &, <, and > in element text and attributes, but malformed source encoding may still replace characters. Relative paths remain relative to the playlist's location; keep the XML file in the expected directory or modify the script to resolve them to absolute paths. URLs and paths remain references, so conversion does not test whether the media is reachable.

M3U vs XML: format comparison

How the M3U and XML formats compare on the properties that matter most for this conversion.

Comparison of the M3U and XML file formats
Property .M3U M3U playlist .XML Extensible Markup Language
Open standard Partly open Yes
Compression Uncompressed Uncompressed
Typical file size Very small Small
Opens in a web browser Partial Yes, natively
Further editing Easy Easy
Metadata support Basic Basic
Plain-text readable Yes Yes
Best used for Music Data exchange
Introduced 1996 1998
Developer — W3C
MIME type audio/x-mpegurl application/xml

Information about file extensions and file types is provided by File-Extensions.org

Frequently asked questions

Will my M3U playlist paths and song information be preserved when converting to XML?

They can be preserved, but only if the XML structure supports the M3U entries and metadata. File paths are usually stored as text, while information such as track length and title may be omitted or renamed if the target schema does not define matching fields.

Is M3U to XML conversion compatible with every media application?

No, because XML is a general markup format rather than one universal playlist format. The result must follow the particular XML schema expected by the media application, or it may not import correctly.

Why does my converted XML playlist fail to open?

The XML may fail because it uses the wrong element names, nesting, character encoding, or path format for the application reading it. Invalid characters in file paths and unsupported M3U directives can also produce an unusable playlist.

Can I convert XML back to M3U without losing information?

Only the playlist paths and metadata that M3U can represent can be recovered reliably. XML-specific fields, nested structures, and application-specific settings may be flattened or discarded when converted back.

Additional formats for
m3u file conversion

Reverse conversion

Convert to xml from
other formats

Share on social media:

Already downloaded

This file has already been downloaded. For your privacy it was deleted from our server right after the download, so it cannot be downloaded again. To get it once more, convert the file again.