Compression & Formats

Codec vs Container: What's the Difference?

Quick answer

A container is the file wrapper — it determines the file extension (MP4, M4A, WAV) and how audio (and video/metadata) is organised inside the file. A codec is the compression algorithm that encoded the audio data inside that container (AAC, MP3, PCM, FLAC). The same container can hold different codecs. The same codec can live in different containers.

Why this confuses everyone

If you've ever wondered why an MP4 video file "contains AAC audio" — or why M4A is described as an audio format but the codec inside is AAC — or why a WAV file is called uncompressed when it technically uses a codec called PCM — you've bumped into the container/codec distinction.

The confusion is understandable. MP3 is both the name of a codec (MPEG-1 Audio Layer III) and the name of the container format that holds it (.mp3 files). They share a name because MP3 was designed as a self-contained format. Most other formats separate the container from the codec — and that separation is what trips people up.

Container vs codec, side by side

The container

  • • The file wrapper / packaging
  • • Determines the file extension
  • • Stores metadata (title, artist, cover art)
  • • Can hold multiple streams (audio + video + subtitles)
  • • Doesn't determine sound quality
  • • Examples: MP4, MKV, M4A, WAV, OGG, WebM

The codec

  • • The compression algorithm
  • • Determines audio quality and file size
  • • Encodes audio when saving; decodes on playback
  • • Can be lossy or lossless
  • • Does determine sound quality
  • • Examples: AAC, MP3, PCM, FLAC, Opus, Vorbis

The box and the language

An analogy that makes the distinction stick: think of the container as a box or package. The codec is the language the contents are written in.

The same box (MP4 container) can hold documents written in English, French, or German (AAC, MP3, or PCM codec). The box format tells you how things are organised inside; the language determines what the content actually says and how it compresses.

Extending the analogy: if you move the documents to a different box (change the container) but don't translate them (don't re-encode), the content is identical. If you translate them into a new language (transcode to a different codec), the meaning is similar but the phrasing changes — and there may be small losses in translation if the new language is less expressive (lossy codec).

Common containers and the codecs inside them

ContainerExtensionCommon audio codecs insideNotes
MP4.mp4AAC (most common), MP3, PCMVideo + audio; used by cameras, phones, web
M4A.m4aAAC (almost always)Audio-only MP4; Apple's preferred audio format
WAV.wavPCM (almost always)Uncompressed audio; Microsoft standard
OGG.oggVorbis, Opus, FLACOpen-source container; codec varies by use
MKV.mkvAAC, MP3, FLAC, OpusFlexible video container; supports many codecs
FLAC.flacFLAC codec onlyBoth the codec and the container share a name
MP3.mp3MP3 codec onlyContainer and codec share a name
WebM.webmVorbis, OpusWeb video/audio; open standard from Google
MOV.movAAC, PCM, MP3Apple's video container; used by iPhones, cameras

Remuxing vs transcoding — why it matters practically

This is where the distinction has real consequences. When you change the container without changing the codec, it's called remuxing. The audio data stays identical — it's just reorganised into a different wrapper. No quality loss, no re-encoding.

When you change the codec — even if you keep the same container — it's called transcoding. The audio is fully decoded and then re-encoded with a different algorithm. If both codecs are lossy, this causes quality loss. If you transcode from lossy to lossless, you get a lossless wrapper around lossy data (no quality gain). If you transcode from lossless to lossy, you get one-time, controlled quality reduction.

No quality loss:MP4 (AAC) → M4A (AAC) — container change only, codec stays AAC
No quality loss:WAV → FLAC — both lossless, audio data is identical
Controlled quality trade-off:FLAC → MP3 — lossless to lossy, one-time compression
Quality loss:MP3 → AAC → MP3 — lossy to lossy to lossy; cumulative degradation

How this affects audio conversion on this site

When you convert an MP4 or MOV file to MP3 here, the audio track is extracted (decoded from whatever codec the video used, often AAC) and then re-encoded as MP3. That's a full transcode — the codec changes — so there is a quality trade-off if the source was lossy.

When you convert WAV to FLAC, you're transcoding from PCM (uncompressed) to FLAC (lossless) — both lossless codecs, so no quality loss. When you convert FLAC to WAV, same story in reverse.

The most important conversion rule: transcode from the highest-quality source available. If you have both an MP3 and a FLAC of the same audio, always convert from the FLAC. The FLAC gives the encoder the full audio data to work with; the MP3 has already been reduced.

Last updated: March 28, 2026