Skip to content
Sunday, November 29, 2026 Security watchAudio formatsThe Friday Mix
BitrateTechnology, culture and everyday life

Audio & FormatsNov 24, 2026 · 6 min read

How MP3 Encoding Works: What an MP3 Encoder Really Does

Learn how an MP3 encoder uses a psychoacoustic model, frequency analysis, quantization and Huffman coding to shrink audio by a factor of 12.

Section
Audio & Formats
Length
1,302 words
Sources
3 cited
Updated
Nov 29, 2026
How MP3 Encoding Works: What an MP3 Encoder Really Does
Photo stux / Pixabay

An MP3 encoder shrinks audio by throwing away what the human ear would barely notice anyway. It analyzes the signal, uses a psychoacoustic model to decide which details are inaudible, then spends its limited bits on the parts you can actually hear. The result is a compression factor of 12 with an acceptable listening experience at sensible bitrates.

What is MP3 and why it works

MP3 is short for MPEG-1 Layer III. The standard was created in 1994 by the Moving Pictures Expert Group, known as MPEG. Its goal is simple: make audio files much smaller without a loss you can hear.

That goal made sense when audio was moving onto the internet and storage was limited. A raw recording is large. A format that cuts the size while keeping the music recognizable changes what people can store and share.

The trick is not general-purpose squeezing. MP3 is lossy by design, which means some information is removed for good. What makes it work is the choice of what to remove, and that choice comes from a model of human hearing.

The numbers at a glance

12
compression factor
20 Hz to 20 kHz
audible range targeted
576
frequency coefficients in a long block
192
coefficients in a short block
64 kbits/sec
minimum per channel for acceptable quality

Typical bitrates

The bitrates you see most often are 128, 192, 256 and 320 kbps. Higher values give the encoder more bits to work with. As a floor, an acceptable result needs at least 64 kbits/sec per channel.

The psychoacoustic model: foundation of MP3 compression

Human hearing covers roughly 20 Hz to 20 kHz. The encoder targets that range and ignores everything outside it. Inside the range, hearing is far from uniform.

How MP3 Encoding Works: What an MP3 Encoder Really Does
Photo: florantevaldez / Pixabay

Also read: AAC vs MP3: Which Audio Format Should You Use in 2026?

The core idea is masking. Some sounds hide others. A loud tone can make a quieter neighbor inaudible. If you cannot hear a component, spending bits on it is wasted effort.

The psychoacoustic model identifies and removes these perceptually inaudible sounds. This is what separates MP3 from simple compression, which treats every detail as equally important.

Slicing the spectrum

To judge masking, the model divides the spectrum into regions. For a long block at 48 kHz, it uses 62 partitions, at a sub-Bark band resolution. Each partition is a slice of frequency that matters perceptually.

For each slice, the model calculates a threshold. Anything below it is inaudible in context. Anything above it needs bits. The thresholds guide how bits are allocated later in the chain.

How an MP3 encoder works: step by step

The encoder takes in PCM audio, typically 16-bit or 24-bit. It then passes the signal through a fixed sequence of stages.

Signal path

PCM input→
FFT analysis→
Psychoacoustic model→
MDCT→
Bit allocation→
Quantization→
Huffman coding→
Frame output
  1. A 1024-point FFT analyzes the frequency content.
  2. The psychoacoustic model computes thresholds.
  3. The MDCT converts time-domain data to the frequency domain.
  4. Bit allocation decides how many bits each sub-band gets.
  5. Quantization rounds the values.
  6. Huffman encoding compresses the rounded values further.
  7. Frame formatting produces the output.

Each stage feeds the next. The model’s thresholds drive the allocation, and the allocation drives how coarsely values are rounded.

Frequency analysis and transformation

The FFT detects which frequencies are present and how strong each one is. This analysis feeds the psychoacoustic model, which needs to know what is loud and what is quiet before it can predict masking.

The MDCT

The Modified Discrete Cosine Transform turns time-domain samples into frequency coefficients. It is well suited to audio because its windows overlap by 50%. That overlap reduces artifacts at the edges between segments.

Long blocks and short blocks

The encoder uses two kinds of blocks. Long blocks carry 576 frequency coefficients. Short blocks carry 192. It picks between them dynamically, depending on the audio.

Long blocks suit stable, sustained sound.

Short blocks suit fast transitions, where the signal changes abruptly.

Bit allocation and the bit reservoir

The allocation algorithm answers one question: how many bits does each frequency region get? The strategy is to give more bits to the frequencies that matter perceptually, and fewer to those that are masked.

Not every moment of music is equally demanding. A complex passage needs more bits than a quiet, simple one. The bit reservoir handles this. It is a temporary buffer that lets the encoder redistribute bits between audio granules according to their complexity.

In practice, a simple moment can leave spare bits behind, and a difficult moment can draw on them. Allocation is smoothed over several frames instead of being rigid. When the reservoir is full, padding bits are added as filler.

Quantization and Huffman encoding

Quantization rounds the frequency coefficients to discrete values. This is where information is actually lost. Coarser rounding saves more bits but adds more error, so the allocation stage decides how much error each region can tolerate.

Scale factors adapt the quantization thresholds. They let the encoder tune the rounding band by band, following what the psychoacoustic model allows.

Huffman coding

Huffman encoding then compresses common patterns in the rounded values more tightly. This step loses nothing, since it only repackages data. It is a key technique that lets Layer III keep high quality at low bitrates.

The final bitstream

The encoder writes its output as a series of frames. Each frame is built from the following parts:

a sync word, which marks where a frame begins

a header

side information

main data

The header carries metadata such as bitrate, sample rate and stereo mode. A decoder reads these to know how to interpret what follows. Stereo data is interleaved within the stream.

Why is 192 kbps often called acceptable?

It sits comfortably above the sourced floor of 64 kbits/sec per channel. We have no listening study that ties specific bitrates to perceived quality, so treat it as a common rule of thumb, not a guarantee.

Can MP3 be lossless?

No. MP3 is lossy by design. Quantization permanently discards information, and no setting turns that around.

How do I choose a bitrate?

Think about what you need to keep. Higher bitrates, such as 256 or 320 kbps, give the encoder more room. Lower ones save space but leave less margin on complex passages. The sourced floor of 64 kbits/sec per channel is the lowest level for acceptable quality.

What is the difference between VBR and CBR?

Constant bitrate keeps the rate fixed. Variable bitrate lets it change over time. The bit reservoir shows the same underlying idea: demanding passages need more bits than simple ones.

Why does MP3 remain popular?

The format is built on a well-understood chain: a psychoacoustic model, the MDCT, quantization and Huffman coding. That chain has been in use since 1994 and delivers a compression factor of 12 with audio that most listeners find acceptable. Format comparisons are outside the scope of this guide.

Sources

Perceptual Coding: How MP3 Compression Works, Sound on Sound

MPEG-1 Layer III Standard: A Simplified Theoretical Review, ResearchGate

The Use of FFT and MDCT in MP3 Audio Compression, University of Utah

How MP3 encoding works and what an MP3 encoder actually does in numbersCreated1994Compression factor12Audible frequency range20 Hz to 20 kHzStandard bitrates128, 192, 256, 320 kbps
Jordan Ellis

Written by

Jordan Ellis

Technology editor

Jordan edits the Technology section and writes about audio formats, codecs and the software people use every day. He has been encoding, tagging and archiving music libraries since the early days of the MP3 and checks every setting against the official documentation.

More from Jordan

Keep reading in Audio & Formats

The whole section