Skip to content

Apple Lossless Audio Codec file (.m4a)

.m4a file signature | audio/mp4

M4A is an audio file format developed by Apple as part of the MPEG-4 media standard and commonly used for Apple Lossless Audio Codec content. It is used for music distribution, audio playback, podcasts, and storage in applications such as iTunes, Apple Music, and other media players. The format is generally safe, though files from untrusted sources may contain malformed metadata or embedded content that can affect vulnerable software.

Safe

Magic Bytes

Offset 4
66 74 79 70 4D 34 41 20

Sources: Apache Tika, Gary Kessler

All Known Signatures

6 signature variants are documented for .m4a files across multiple sources.

Hex Signature Offset Sources
66 74 79 70 4D 34 41 20 4 Apache Tika, Gary Kessler
66 74 79 70 4D 34 42 20 4 Apache Tika
66 74 79 70 46 34 41 20 4 Apache Tika
66 74 79 70 46 34 42 20 4 Apache Tika
66 74 79 70 33 67 70 4 Gary Kessler
4D 34 41 20 0 Neil Harvey FileSignatures

Extension

.m4a

MIME Type

audio/mp4

Byte Offset

4

Risk Level

Safe

Validation Code

How to validate .m4a files in Python

Python
def is_m4a(file_path: str) -> bool:
    """Check if file is a valid M4A by magic bytes at offset 4."""
    signature = bytes([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20])
    with open(file_path, "rb") as f:
        f.seek(4)
        return f.read(8) == signature

How to validate .m4a files in Node.js

Node.js
function isM4A(buffer: Buffer): boolean {
  const signature = Buffer.from([0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20]);
  if (buffer.length < 12) return false;
  return buffer.subarray(4, 12).equals(signature);
}

How to validate .m4a files in Go

Go
func IsM4A(data []byte) bool {
    signature := []byte{0x66, 0x74, 0x79, 0x70, 0x4D, 0x34, 0x41, 0x20}
    if len(data) < 12 {
        return false
    }
    return bytes.Equal(data[4:12], signature)
}

API Endpoint

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

See the full API documentation for all endpoints and parameters.

Related Formats

Frequently Asked Questions

What is a .m4a file?

A .m4a file is a Apple Lossless Audio Codec file file. M4A is an audio file format developed by Apple as part of the MPEG-4 media standard and commonly used for Apple Lossless Audio Codec content. It is used for music distribution, audio playback, podcasts, and storage in applications such as iTunes, Apple Music, and other media players. The format is generally safe, though files from untrusted sources may contain malformed metadata or embedded content that can affect vulnerable software.

What are the magic bytes for .m4a files?

The magic bytes for Apple Lossless Audio Codec file files are 66 74 79 70 4D 34 41 20 at byte offset 4. These bytes uniquely identify the file format regardless of the file extension.

How do I validate a .m4a file?

To validate a .m4a file, read the first bytes of the file and compare them against the known magic bytes (66 74 79 70 4D 34 41 20) at offset 4. This is more reliable than checking the file extension alone, as extensions can be renamed.

What is the MIME type for .m4a files?

The primary MIME type for .m4a files is audio/mp4.

Is it safe to open .m4a files?

Apple Lossless Audio Codec file (.m4a) 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.