MP3 file format
MPEG-1/2 Audio Layer III, the ubiquitous lossy audio format.
- MIME type
- audio/mpeg
- Extensions
- .mp3
- Category
- Audio
Magic-number signature
| 0x00000000 | 494433 | ID3 | 'ID3' metadata tag |
Tagless MP3s instead start with an MPEG frame sync: FF followed by a byte with its top 3 bits set.
About the MP3 format
MP3 is the format that made portable digital music mainstream, using a perceptual model of hearing to discard what most listeners cannot detect and shrink audio to roughly a tenth of its raw size. It is not a container in any real sense: an MP3 file is a bare sequence of independent frames, each one about 26 milliseconds long and each carrying its own four-byte header stating its bitrate, sample rate and channel mode. There is no file-level length, no index, and no table of contents, which is why an MP3 can be cut anywhere with a text editor and still play. Almost every file in the wild is preceded by an ID3v2 tag holding the title, artist and cover art, and that tag is what supplies the recognisable ASCII at offset 0.
Header layout, byte by byte
| Offset | Length | Field | Meaning |
|---|---|---|---|
| 0 | 3 | ID3v2 identifier | 49 44 33, the ASCII letters ID3. This is a metadata tag bolted onto the front of the audio, not part of the MP3 format itself, and a perfectly valid MP3 may have none at all — in which case the file opens straight into a frame header. |
| 3 | 2 | ID3v2 version | Major version then revision: 03 00 for ID3v2.3 and 04 00 for ID3v2.4, the two versions in real use. The revision byte is always 00, and neither byte may be FF. |
| 5 | 1 | ID3v2 flags | Bit 7 marks the tag unsynchronised, bit 6 says an extended header follows, bit 5 marks it experimental, and bit 4, in version 2.4 only, says a ten-byte footer sits at the end of the tag. Most files have all of them clear. |
| 6 | 4 | ID3v2 tag size | A syncsafe integer: four bytes each with its top bit forced to zero, contributing seven usable bits, for 28 bits in total. The value excludes the ten-byte header. Writers that forget the syncsafe encoding produce a size that is too large, and the decoder then skips into the middle of the audio and loses the opening fraction of a second. |
| 10 | variable | ID3v2 frames | The tag body, as many bytes as the size at offset 6 declared. Each frame is a four-character identifier, a size and flags: TIT2 for the title, TPE1 for the artist, TALB for the album, TSSE for the encoder, APIC for cover art. Album art routinely makes this section far larger than a minute of the audio behind it. |
| 45 | 4 | First MPEG audio frame header | Where the audio actually starts — ten bytes of ID3 header plus whatever the size at offset 6 said, so the 45 in the offset column is what a 35-byte tag gives and it moves with the tag in every other file. A frame header of FF FB 40 C0 decodes as eleven set sync bits, then MPEG version 1, layer III, no CRC; then bitrate index 4 and sample-rate index 0, meaning 56 kbps at 44100 Hz; then channel mode 3, mono. |
| 66 | 4 | Xing or Info tag | A pseudo-frame carrying the total frame count and a seek table, sitting inside the first audio frame after the header and the side information — 17 bytes for MPEG-1 mono, 32 for MPEG-1 stereo, 9 and 17 for MPEG-2 — which puts it 21 bytes into the frame here. It reads Xing on a variable-bitrate file and Info on a constant-bitrate one, and its absence is why some players report a wildly wrong duration. |
| -128 | 128 | ID3v1 tag | The original metadata format, a fixed 128-byte block at the very end of the file beginning with the ASCII letters TAG, 54 41 47. Thirty bytes each for title, artist and album, four for the year, thirty for a comment and one for a genre number. It is still written for compatibility, and a decoder that does not know about it plays it as a short burst of noise. |
Telling it apart from its neighbours
| Easily confused with | How to tell |
|---|---|
| ADTS AAC | The trap for anything testing only for a frame sync. A raw .aac file begins FF F1 or FF F9, which passes an eleven-bit sync test just as an MP3 frame does. The separator is the two layer bits, bits 2 and 1 of the second byte: MP3 has 01 for Layer III, while ADTS leaves them 00, a value MPEG-1 audio reserves and never uses. Checking the full frame header rather than the sync alone is what avoids this. |
| MP2/MP1 | Identical frame structure and the same FF Ex sync, differing only in those same layer bits — 10 for Layer II and 11 for Layer I. MP2 is still in use in broadcast, so files do turn up, and a player that assumes Layer III on any MPEG audio sync will decode noise rather than refuse. |
| FLAC | Not confusable in a hex editor, since FLAC opens with the readable ASCII fLaC, but confused constantly in practice because both extensions describe the same album. There is a real byte-level hazard here in one direction: some careless taggers write an ID3v2 tag onto the front of a FLAC file, which the FLAC specification does not permit, and the result then looks like an MP3 to any detector that stops at 49 44 33. |
| WAV | A RIFF WAV file can contain MP3 data rather than PCM, declared by the format tag 0x0055 in its 'fmt ' chunk. Such a file begins 52 49 46 46 and is a WAV by every structural test, while the bytes inside it are ordinary MP3 frames. Renaming it to .mp3 leaves the RIFF header in place and most decoders then stumble over the first forty-odd bytes. |
How these files break
- Garbage between the tag and the first frame. A partial download, an ID3 size written wrong, or a stray block of album art leaves bytes that are not a frame header where one should be. Decoders resynchronise by scanning forward for the next FF Ex pattern, so the audio plays — after a click, and with a duration computed from the wrong starting point.
- A variable-bitrate file with no Xing header. Without the frame count in that pseudo-frame a player has no choice but to estimate the length from the bitrate of the first frame it sees, which on a VBR file is simply wrong. The symptom is a track that says three minutes, plays for five, and seeks to the wrong place every time.
- Truncation. Because there is no file-level length anywhere in the format, a truncated MP3 is indistinguishable from a shorter one: it plays cleanly to the cut and stops with no error at all. The only hints are the frame count in the Xing header, if there is one, and a final frame that ends before its declared length.
- An ID3v1 tag decoded as audio. The 128-byte block at the end begins with TAG and is not a frame, so a decoder that walks frames to the end of the file and does not check for it emits a short burst of noise. It is the classic click at the end of a track ripped by older software.
- An ID3v2 size field that is not syncsafe. Some writers put an ordinary big-endian integer at offset 6, which reads larger than the real tag because each byte can then exceed 127. The decoder skips too far, lands inside the audio, and the first fraction of a second is gone — a tagger bug that leaves the audio itself completely intact.
Where the format stands today
MP3 is technically obsolete and practically unavoidable. AAC beats it at the same bitrate and is what streaming services and every phone recording actually use; Opus beats both below 64 kbps and is what voice and real-time audio run on. None of that has displaced MP3, because the last of its patents expired in 2017 and it now enjoys something none of its successors do — every device made in the last twenty-five years plays it, with no licence, no negotiation and no fallback. That makes it the default for podcasts, for audiobooks, for anything downloaded rather than streamed, and for car stereos and cheap hardware players that will never see a firmware update. For anything you intend to edit or re-encode it is the wrong choice, because each pass through the encoder loses more, and for archival the right answer is a lossless format with the MP3 generated from it on demand.
Open MP3 files on this site
Every one of these runs in your browser — the file never leaves your machine.
Related formats
Formats that are easy to confuse with MP3 — compare their leading bytes.