# .alac

> The `.alac` (Apple Lossless Audio Codec) is a lossless audio compression format developed by Apple to compress audio without any quality loss.

## What is ALAC and how is it different from FLAC?

The lossless audio compression format developed by Apple and now open source, ensuring audio quality remains the same as the original source. It's mainly used across Apple devices and services.

- Topic: Audio
- Type: format

## Example

Wrong:

```html
<audio controls>
  <source src="song-alac.m4a" type="audio/mp4">
</audio>
```

Right:

```html
<audio controls>
  <source src="song-aac.m4a" type="audio/mp4; codecs=mp4a.40.2">
  <source src="song.mp3" type="audio/mpeg">
</audio>
```

ALAC suits archives; web playback uses AAC, with a `codecs` value that lets the browser check support first.

## Common mistakes

- Expecting an `.m4a` file to be lossy, while it can hold lossless ALAC as well as AAC.
- Streaming ALAC on a web page, where most browsers outside Apple platforms may not play it.

## Interview questions

### ALAC vs FLAC: which should I use?

Both are lossless with similar sizes. Use ALAC for Apple devices and apps, and FLAC for wide support elsewhere.

### What file extension does ALAC use?

ALAC is usually stored in an MP4 container with the `.m4a` extension, the same extension used for AAC audio.

### Is ALAC free to use?

Yes. Apple released ALAC as open source, so anyone can encode and decode it.

## Related cards

- [.flac](https://wonderium.dev/engineering/flac.md)
- [.aac](https://wonderium.dev/engineering/aac.md)
- [.wav](https://wonderium.dev/engineering/wav.md)
- [`<audio>`](https://wonderium.dev/html/audio.md)

---

- Level: [Engineering](https://wonderium.dev/engineering.md)
- HTML version: https://wonderium.dev/engineering/alac
- Last updated: 2026-11-25
