Skip to content

M3U (.m3u)

.m3u file signature | audio/x-mpegurl

Multimedia playlist

Safe

Magic Bytes

Offset 0
23 45 58 54 4D 33 55 0D 0A

Sources: Apache Tika

All Known Signatures

2 signature variants are documented for .m3u files across multiple sources.

Hex Signature Offset Sources
23 45 58 54 4D 33 55 0D 0A 0 Apache Tika
23 45 58 54 4D 33 55 0 Wikipedia

Extension

.m3u

MIME Type

audio/x-mpegurl

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .m3u files in Python

Python
def is_m3u(file_path: str) -> bool:
    """Check if file is a valid M3U by magic bytes."""
    signature = bytes([0x23, 0x45, 0x58, 0x54, 0x4D, 0x33, 0x55, 0x0D, 0x0A])
    with open(file_path, "rb") as f:
        return f.read(9) == signature

How to validate .m3u files in Node.js

Node.js
function isM3U(buffer: Buffer): boolean {
  const signature = Buffer.from([0x23, 0x45, 0x58, 0x54, 0x4D, 0x33, 0x55, 0x0D, 0x0A]);
  return buffer.subarray(0, 9).equals(signature);
}

How to validate .m3u files in Go

Go
func IsM3U(data []byte) bool {
    signature := []byte{0x23, 0x45, 0x58, 0x54, 0x4D, 0x33, 0x55, 0x0D, 0x0A}
    if len(data) < 9 {
        return false
    }
    return bytes.Equal(data[:9], signature)
}

API Endpoint

GET /api/v1/m3u
curl https://filesignature.org/api/v1/m3u

See the full API documentation for all endpoints and parameters.

Frequently Asked Questions

What is a .m3u file?

A .m3u file is a M3U file. Multimedia playlist

What are the magic bytes for .m3u files?

The magic bytes for M3U files are 23 45 58 54 4D 33 55 0D 0A at byte offset 0. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .m3u file?

To validate a .m3u file, read the first bytes of the file and compare them against the known magic bytes (23 45 58 54 4D 33 55 0D 0A) at offset 0. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .m3u files?

The primary MIME type for .m3u files is audio/x-mpegurl.

Is it safe to open .m3u files?

M3U (.m3u) files are generally safe to open. They are classified as low risk because they primarily contain data rather than executable code. However, always ensure files come from a trusted source.