Last updated: January 14

<span aria-hidden="true" id="what-is-an-audio-codec"></span>

# What is an audio codec?

![Kevin van Zonneveld](/assets/images/teammates/avatar-kvz-4.jpg?dpl=dpl_6nhQNS5wkVkPZWuKMzXcWrAHNJL5)

**Kevin van Zonneveld**

Co-founder · Amsterdam, The Netherlands · Show bio

[](https://x.com/kvz)[](https://github.com/kvz)

An audio codec (coder/decoder) is the algorithm that compresses and decompresses sound. It decides how audio is stored or streamed, how large the file is for a given quality, and which devices can play it back. Picking the right codec is a balance of fidelity, bitrate, latency, and compatibility.

![An abstract waveform around the text “What is an audio codec?”](/blog/2026/01/what-is-an-audio-codec/opengraph-image/)

<span aria-hidden="true" id="codec-vs-container"></span>

## Codec vs. container

A codec is not the same thing as a container. A container (such as MP4, MKV, or WebM) is the wrapper that can hold one or more audio and video streams, plus metadata. The codec is the actual compression method used inside that container. For example, an MP4 file often contains AAC audio, while a WebM file typically contains Opus or Vorbis audio.

<span aria-hidden="true" id="how-audio-codecs-work"></span>

## How audio codecs work

Raw digital audio is usually stored as PCM (pulse‑code modulation). PCM is accurate, but large. A codec reduces size by applying compression. Lossless codecs compress PCM without removing information. Lossy codecs go further by discarding details that are less audible to the human ear (psychoacoustic modeling), which yields much smaller files at the cost of some quality.

<span aria-hidden="true" id="lossy-lossless-and-uncompressed"></span>

## Lossy, lossless, and uncompressed

* **Lossy**: removes data to shrink files. Best for streaming and general listening when size matters. Examples: MP3, AAC, Opus.
* **Lossless**: preserves all information while still compressing. Best for mastering, archival, and professional workflows. Examples: FLAC, ALAC.
* **Uncompressed**: stores raw PCM. Best for editing pipelines that need zero compression overhead. Examples: WAV, AIFF.

<span aria-hidden="true" id="key-settings-that-affect-quality-and-size"></span>

## Key settings that affect quality and size

* **Bitrate**: the most direct lever for size and quality. Higher bitrate usually means better quality. Variable bitrate (VBR) adapts to complexity; constant bitrate (CBR) is predictable.
* **Sample rate**: the amount of samples per second (e.g., 44.1 kHz, 48 kHz). Higher rates capture more detail, but increase size.
* **Channels**: mono, stereo, or multichannel. The more channels, the larger the size.
* **Bit depth**: mainly relevant for lossless/uncompressed audio (e.g., 16‑bit vs. 24‑bit).

<span aria-hidden="true" id="common-audio-codecs-and-when-to-use-them"></span>

## Common audio codecs and when to use them

* **AAC**: a strong default for music and general playback; excellent compatibility in MP4.
* **MP3**: legacy, still widely supported, but less efficient than AAC or Opus at the same bitrate.
* **Opus**: great for voice, real‑time, and low‑bitrate streaming; excellent quality at small sizes.
* **FLAC**: lossless compression for archiving and distribution of high‑quality audio.
* **WAV/AIFF**: uncompressed PCM for editing pipelines and interchange.

<span aria-hidden="true" id="how-to-choose-the-right-codec"></span>

## How to choose the right codec

* **Streaming or podcasts**: AAC or Opus, depending on device support requirements.
* **Voice or real‑time**: Opus for low latency and efficiency.
* **Archival or mastering**: FLAC or WAV.
* **Maximum compatibility**: MP3 still wins on legacy devices, but AAC is broadly supported too.

<span aria-hidden="true" id="encode-audio-using-transloadit"></span>

## Encode audio using Transloadit

Our [🤖 /audio/encode](/docs/robots/audio-encode.md) Robot lets you convert audio to popular codecs with a few parameters. Here’s a minimal example that converts an upload to MP3 at 128 kbps:

```json
{
  "steps": {
    "encode_mp3": {
      "robot": "/audio/encode",
      "use": ":original",
      "preset": "mp3",
      "bitrate": 128000
    },
    "store": {
      "robot": "/s3/store",
      "use": "encode_mp3"
    }
  }
}

```

Need lossless output or different sample rates? Just switch the preset or set `sample_rate` and`bitrate` accordingly.

[![Audio Encoding](/assets/images/services/audio-encoding.svg?dpl=dpl_6nhQNS5wkVkPZWuKMzXcWrAHNJL5)Audio EncodingHigh-quality FLAC encoding](/demos/audio-encoding/encode-into-flac.md)

[![Audio Encoding](/assets/images/services/audio-encoding.svg?dpl=dpl_6nhQNS5wkVkPZWuKMzXcWrAHNJL5)Audio EncodingEncoding with a specific bit rate](/demos/audio-encoding/encode-with-different-bitrate-and-samplerate.md)

[![Audio Encoding](/assets/images/services/audio-encoding.svg?dpl=dpl_6nhQNS5wkVkPZWuKMzXcWrAHNJL5)Audio EncodingLoudness Normalization](/demos/audio-encoding/normalize-volume-in-audio.md)

<span aria-hidden="true" id="next-steps"></span>

## Next steps

* Explore [Audio Encoding](/services/audio-encoding.md) and browse the[🤖 /audio/encode](/docs/robots/audio-encode.md) docs.
* Need help choosing a codec? Reach out at [hello@transloadit.com⁠](mailto:hello@transloadit.com).

[#audio-encoding-service](/blog/tags/audio-encoding-service.md)[#audio-encode-robot](/blog/tags/audio-encode-robot.md)

### 👩‍💻 Join 20k+ developers

Sign up for our [monthly newsletter](/newsletters.md) to receive direct links to 3 exclusive tech — and 2 product updates. No less, no more.

Your email:

Get access

## File uploading and encoding. Made simple.

Transloadit streamlines file handling for developers, trusted by brands like Coursera and The New York Times. We’re known for a reliable API, top-notch support, and a strong commitment to open source, with projects like [Uppy⁠](https://uppy.io) and [Tus⁠](https://tus.io) setting standards in file processing.

[Sign up](/c/)[Book a Demo](https://survey.typeform.com/to/kRg47Xi5)

No credit card needed · 5 GB included in the free plan

Cancel anytime
