DevToolsmith

M4A MIME Type

audio/mp4 is the MIME type for M4A (AAC in an MP4 container) audio. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
audio/mp4
Extensions
.m4a
Content-Type header
audio/mp4
Registered
Yes, with IANA
Compress with gzip
No, it is already compressed
Category
Audio

About M4A audio files

An MP4 file with only an audio track, usually AAC. Apple software uses audio/x-m4a; the registered type is audio/mp4. Browsers play both, and for upload filters it is worth accepting both.

Other types seen for these files: audio/x-m4a , audio/m4a . Accept them when reading uploads, but send audio/mp4 yourself.

File signature

M4A files start with "ftypM4A " at byte 4. The extension and the type a browser reports for an upload both come from the file name, so check these bytes on the server before trusting a file.

Serve .m4a with the right Content-Type

Response header
Content-Type: audio/mp4
nginx (a line in the types { } block of mime.types)
audio/mp4 m4a;
Apache (.htaccess or server config)
AddType audio/mp4 .m4a
Caddy
@m4a path *.m4a
header @m4a Content-Type "audio/mp4"
Check what a server sends
curl -sI https://example.com/file.m4a | grep -i '^content-type'
# Content-Type: audio/mp4

Set the type in code

Node.js (Express)
res.set('Content-Type', 'audio/mp4');
// Or make the browser download it:
res.attachment('file.m4a');
Python
import mimetypes

mimetypes.add_type('audio/mp4', '.m4a')  # if your system doesn't know it
mimetypes.guess_type('file.m4a')[0]  # 'audio/mp4'
Go
mime.AddExtensionType(".m4a", "audio/mp4")
w.Header().Set("Content-Type", "audio/mp4")

Accept .m4a uploads

HTML
<input type="file" accept=".m4a,audio/mp4">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .aac (audio/aac): AAC audio
  • .mp3 (audio/mpeg): MP3 audio
  • .mp4 (video/mp4): MP4 video

More audio

.wav , .ogg , .flac . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .m4a files?

audio/mp4. You may also see audio/x-m4a, audio/m4a, which are older or unofficial; send audio/mp4. The full header is "Content-Type: audio/mp4".

Why does my server send the wrong Content-Type for .m4a?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .m4a is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is M4A?

Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. M4A files start with "ftypM4A " at byte 4. The MIME type lookup on this site reads them for you when you drop a file on it.