WAV Header Inspector

Parse WAV/RIFF header to show sample rate, channels, bit depth, and duration

Ad placeholder (leaderboard)

Decode the technical header of a WAV file — its sample rate, channel count, bit depth, encoding and exact duration — without any player or upload. The inspector reads the RIFF/WAVE structure directly with the browser’s DataView API and stays entirely on your device.

How it works

A WAV file is a RIFF container. The first 12 bytes are the ASCII tag RIFF, a little-endian 4-byte total size, and the ASCII tag WAVE. After that comes a sequence of chunks, each one a 4-character ID, a little-endian 4-byte size, and that many bytes of payload (padded to an even length).

The two chunks that matter are:

fmt   → audio parameters
  audioFormat  (2 bytes)  1=PCM, 3=float, 6=A-law, 7=mu-law, 65534=extensible
  numChannels  (2 bytes)
  sampleRate   (4 bytes)
  byteRate     (4 bytes)  = sampleRate × channels × bitDepth/8
  blockAlign   (2 bytes)  = channels × bitDepth/8
  bitsPerSample(2 bytes)

data  → the raw samples; its size gives the audio payload length

The inspector walks the chunk list rather than assuming a fixed layout, so it correctly handles files that place LIST or fact chunks before fmt or data.

Duration

Playback length comes straight from the data chunk:

duration (s) = data chunk size (bytes) ÷ byteRate

Because byteRate = sampleRate × channels × bitDepth / 8, a 10-second 44.1 kHz 16-bit stereo clip has a data chunk of 10 × 44100 × 2 × 2 = 1,764,000 bytes.

Tips

  • A mismatch between the stored byteRate and sampleRate × channels × bitDepth/8 usually means a malformed or non-standard encoder — the inspector shows both so you can compare.
  • Format code 65534 (extensible) wraps a real sub-format GUID; the bit depth and channels are still valid in the fmt chunk.
  • Very large declared sizes that exceed the actual file length indicate truncation or a streaming WAV written before the final size was known.
Ad placeholder (rectangle)