MP3 files are compressed audio that uses perceptual coding to reduce the file size while preserving an adequate listening experience.
The format has stood the test of time as an efficient, portable option for playing back music on a variety of devices, but is also available in alternatives like AAC, FLAC, WAV/PCM, and Opus.
MP3 File Structure
An MPEG-1/MPEG-2 Audio Layer III (also known as an .mp3) isn’t a media container in the way M4A or MP4 is; it’s a bare audio-frame stream usually accompanied by metadata: The format stores two parts. First, it contains what we’d call audio frames, which represent the actual content that you hear when playing back the file. Second, the format contains ID3 metadata, which includes track information such as the title, artist, album, etc. MP3 files normally use the .mp3 extension and the audio/mpeg MIME type.

But what do we mean by an “audio frame”? A single frame consists of data that represents one small portion of the sound that’s played back at the same rate as your chosen sample rate. These frames are what actually contain the audio itself.
MPEG-1/Audio Layer III
MP3 development began in the late 1980s, and MPEG-1 Audio Layer III was standardized as ISO/IEC 11172-3 in 1993. In 1995, the MPEG-2 extension added lower sample rates. Both standards refer to an MPEG-1/MPEG-2 Audio Layer III (sometimes abbreviated as MPA). For this article, we’re focusing primarily on the first, or MPEG-1, audio layer, though there are differences between the two.
In terms of the encoding process, MP3s use what’s called lossy perceptual coding. Here’s how it works: An encoder uses what’s called a psychoacoustic model to determine which bits it can spend more or less on, depending on how noticeable they are within the context of the overall recording. If an area of the sound isn’t heard, or is otherwise considered unimportant to the average human ear, the encoder spends fewer bits on that sound. What’s discarded, however, can’t be recovered later. That means there’s a risk that certain bits may be lost entirely, potentially creating artifacts.
For the average user, the difference may not matter much, particularly if you’re using a modern, high-quality MP3 codec with decent settings. However, because some bits are literally lost, MP3 files aren’t lossless. That doesn’t mean all of them will sound bad; rather, just that there’s always the potential for some distortion or degradation.
It’s important to understand that these results aren’t guaranteed either; an encoder’s choice of compression settings can have an effect. Some encoders produce very clean, almost transparent sound, while others leave behind subtle artifacts.
Bitrate and Sample Rate
Practically speaking, there are several ways that users can control the quality of their encoded audio. The first of those is known as the bitrate, which measures the number of kilobits per second used to encode each second of sound. You’ll typically see bitrates listed in kilobits per second, or kbps, with most common MPEG-1 MP3s falling in the range of 32–320kbps, while MPEG-2 can go as low as 8kbps.
You might want to think of bitrate and sampling rate as inversely related: A higher-bitrate file takes up more space than a lower-bitrate one does. Likewise, a higher sampling rate produces a higher-fidelity audio experience.
There’s also another factor known as sample rate. This determines the frequency range that a given audio file can capture. Higher sampling rates generally provide a better listening experience, and allow for a broader frequency response. But again, a tradeoff is made between quality and file size. MPEG-1 MP3 supports 32, 44.1, and 48 kHz sample rates, with lower rates in MPEG-2 and MPEG-2.5 modes.
A good rule of thumb for beginners who are new to audio encoding is to choose the lowest acceptable setting — 128kbps at 48kHz — for stereo recordings. However, if your storage constraints allow, 192kbps is preferable. Keep in mind that a higher sampling rate, such as 44.1kHz or 48kHz, is ideal. Note that some sources specify a sampling rate of 8kHz, usually for voice only. That’s an older technology and not commonly used anymore.
The standard defines a maximum of 320kbps. Again, there’s a tradeoff between the amount of space a given file consumes and the fidelity of the resulting audio. In general, the higher the quality, the larger the file becomes.
The choices of both sampling rate and bitrate are usually referred to collectively as the “quality” of the audio file. However, in practice, you might want to choose either CBR (constant bitrate) or VBR (variable bitrate), allowing the file to shift around where it places its bits.
CBR vs. VBR
CBR stands for constant bitrate, meaning that the file maintains a steady data rate throughout. VBR, or variable bitrate, allows the file to shift where it places its bits between passages that are relatively simple and more complex musical passages.
Alternatively, you can choose an ABR (average bitrate), where the encoder tries to target an average, balancing both simple and complex passages. While ABR provides some benefits, especially over CBR, VBR generally offers a superior balance of quality and efficiency.
Other Formats
MP3 is a widely supported, portable format that allows users to enjoy music on virtually any device or platform. However, it isn’t without competition. MDN’s browser compatibility table lists MP3 support in Chrome, Edge, Firefox, Opera, and Safari. Below, we outline a few of the primary competing formats:
AAC (Advanced Audio Coding): This format is more efficient than MP3 and provides similar levels of quality.
FLAC (Free Lossless Audio Codec): As the name suggests, this is a lossless audio format. It allows users to decompress their audio back into the exact original form it was recorded in. However, the files themselves are significantly larger than comparable MP3s.
WAV (Waveform Audio File Format) / PCM: This is simply a basic, unencoded digital audio format. It preserves the full fidelity of the original recording, though requires a significantly larger file size. Many people record their own video or music using WAV files for editing purposes.
Opus: This is an open source audio format, and is typically designed for low-bitrate situations. It supports effective sampling rates from 8kHz up to 48kHz. Opus is typically used in conjunction with WebRTC, and is also used for VoIP and other applications requiring real-time, low-latency audio playback.
Licensing and Patent Issues
The last core patent covering the implementation of MP3 expired in 2017, which officially ended Fraunhofer’s licensing program. Fraunhofer noted that the last core MP3 patent covered under the program had already expired, though the usage permit did not end. Fraunhofer continues to maintain patents in the field of audio compression and processing, and explained that there are additional, manufacturer-specific patents still being reviewed by manufacturers. Therefore, Fraunhofer recommends that developers review their implementation-specific patents.
Choosing Between Formats
If you’re using personally owned or authorized audio, consider what your goals are when choosing a format:
Choose MP3 when you want a widely compatible, space-efficient file, especially across older or mixed devices.
Use a lossless format, such as FLAC, for archival purposes or when you plan to edit your audio down the road.
Choose a newer audio format, such as AAC or Opus, if you know your target device supports them.
Note: The above advice assumes you’re working with legally licensed audio.