WAV files begin with a 44-byte header. Every field is fixed-width and little-endian. You can read or repair one with a hex editor and this byte-by-byte reference. No special tools required.

The RIFF Chunk File Identifier and Size

Open the file in a hex editor. At offset 0, four bytes spell RIFF in ASCII. Offset 4 holds a 32-bit little-endian value: the RIFF chunk size. It equals total file size minus 8. Offset 8 contains the four bytes WAVE. That identifies the file as WAV inside the RIFF container.

A hex dump's first 12 bytes are the quickest check. Missing or corrupted RIFF or WAVE markers are the most common reason a file will not open.

The Fmt Chunk Audio Format Details

Offset 12 holds the ASCII characters fmt, including the trailing space. This is the format chunk identifier. Offset 16 is the fmt chunk size. Set it to 16 for plain PCM audio. Offset 20 stores the audio format as a 16-bit little-endian integer: 1 means PCM, 3 means IEEE float. Offset 22 holds the number of channels, also 16-bit little-endian.

Sample Rate and Byte Rate

Offset 24 is the sample rate as a 32-bit little-endian integer. Offset 28 is the byte rate. Calculate it as sample rate × channels × bytes per sample. Players use this value to stream audio correctly.

Block Align and Bits Per Sample

Offset 32 gives the block align. It equals channels × bytes per sample. Read it as a 16-bit little-endian integer. Offset 34 stores bits per sample, such as16 or24. Together these define the size of each audio frame.

The Data Chunk and Audio Start

Offset 36 contains the ASCII data identifier. Offset 40 is a 32-bit little-endian value: the size of the audio data in bytes. The audio samples begin immediately after the data size field.

Do not assume audio starts at offset 44. Real files often carry extra chunks between fmt and data. LIST, bext, and JUNK chunks each have their own identifier and size field. When repairing a header, locate the data marker to find the true audio start.

Practical Byte Offset Table

Here is the canonical 44-byte WAV header at a glance:

  • Offset 0 RIFF (ASCII)
  • Offset 4 RIFF chunk size (32-bit little-endian, file size minus8)
  • Offset 8 WAVE (ASCII)
  • Offset 12 fmt (ASCII, with space)
  • Offset 16 fmt chunk size (16 for PCM)
  • Offset 20 Audio format (1 = PCM,3 = IEEE float)
  • Offset 22 Number of channels
  • Offset 24 Sample rate
  • Offset 28 Byte rate
  • Offset 32 Block align
  • Offset 34 Bits per sample
  • Offset 36 data (ASCII)
  • Offset 40 Data size in bytes

How to Inspect a Broken Header

When a WAV file is corrupted, header bytes may be shifted, zeroed, or overwritten. Open the file in a hex editor. Check each offset against the table above.

If the RIFF or WAVE markers are missing, restore them from a known-good file with matching audio parameters. If the file contains extra chunks, the audio start offset will be greater than44. Scan for the data ASCII bytes and read the data size at the following four bytes. Audio samples begin immediately after that field.

  1. Open the file in a hex editor.
  2. Verify bytes at offset0 are RIFF.
  3. Check offset8 for WAVE.
  4. Find the fmt chunk at offset12 and confirm the format values.
  5. Locate the data chunk and note the data size and audio start offset.

Common Header Errors and Quick Fixes

Some frequent problems and their fixes:

  • Missing RIFF marker: Replace the first four bytes with RIFF and update the chunk size at offset4.
  • Wrong fmt chunk size: Set offset16 to16 for PCM.
  • Incorrect byte rate: Recalculate as sample rate × channels × bytes per sample. Write the32-bit little-endian value at offset28.
  • Data size mismatch: The value at offset40 must equal the number of bytes of audio data. If the file plays only partially, this value is too large or too small. Correct it.

When Audio Does Not Start at Offset44

Extra chunks like LIST, bext, or JUNK can appear between the fmt chunk and the data chunk. Each carries its own identifier and size field. To find the audio data, scan forward from offset36 for the data bytes. The following four bytes give the data size. Audio begins right after that. Ignore any other chunks. They are not required for playback.

If you need to repair a file with extra chunks, you can preserve them or strip them out. If you strip them, update the RIFF chunk size at offset4 to reflect the new file size minus8.