# .wav

> The `.wav` (Waveform Audio File Format) is an uncompressed audio format that stores sound in raw, high-quality form.

## What is a WAV file and should I use it on a website?

The audio format that stores sound without compression, preserving full audio quality. Due to its large file sizes, it's commonly used in professional audio recording and editing.

- Topic: Audio
- Type: format

## Example

Wrong:

```html
<audio controls>
  <source src="interview.wav" type="audio/wav">
</audio>
```

Right:

```html
<audio controls preload="metadata">
  <source src="interview.opus" type="audio/ogg; codecs=opus">
  <source src="interview.mp3" type="audio/mpeg">
</audio>
```

Compressed Opus and MP3 files are many times smaller than WAV and sound the same to most listeners on the web.

## Common mistakes

- Shipping WAV sound effects that weigh megabytes and slow down page load.
- Assuming every WAV is uncompressed, while some hold compressed codecs players may not support.

## Key points

- Web pages serve compressed audio such as `.mp3`, `.aac` or `.opus` instead of large `.wav` files.
- When WAV is used, the `<source>` has `type='audio/wav'` and a compressed fallback.
- Audio recorded in the browser is compressed before upload, not sent as raw PCM.

## Interview questions

### WAV vs MP3: what is the difference?

WAV usually stores raw uncompressed PCM audio, so it keeps full quality but is large. MP3 uses lossy compression and is about ten times smaller.

### Is WAV better than FLAC?

Both keep full quality. FLAC is lossless but compressed, so files are roughly half the size of WAV with identical sound.

### Why are WAV files so big?

WAV typically stores every sample without compression. One minute of CD-quality stereo audio takes about 10 MB.

## Related cards

- [.mp3](https://wonderium.dev/engineering/mp3.md)
- [.flac](https://wonderium.dev/engineering/flac.md)
- [`<audio>`](https://wonderium.dev/html/audio.md)
- [AudioContext](https://wonderium.dev/js/audio-context.md)

---

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