ByteScope

WAV file format

Waveform Audio, an uncompressed (typically PCM) RIFF audio container.

MIME type
audio/wav
Extensions
.wav
Category
Audio

Magic-number signature

0x0000000052494646RIFFRIFF container
0x0000000857415645WAVE'WAVE' form type

About the WAV format

WAV stores audio as raw PCM samples inside a RIFF container, giving lossless quality and simple editing at the cost of large files — the standard for recording and production. The header is 'RIFF', a length, then the form type 'WAVE'. Everything after those first four bytes is little-endian, and the file is a flat list of chunks: a four-byte chunk id, a four-byte size, then that many bytes of payload, padded to an even length. That layout is why WAV is trivial to write and trivial to get subtly wrong: nothing in the file cross-checks anything else, so a size field that disagrees with reality is a perfectly well-formed WAV that no player handles the same way.

Header layout, byte by byte

OffsetLengthFieldMeaning
04RIFF chunk idThe ASCII letters RIFF, 52 49 46 46. RIFF is Microsoft and IBM's generic Resource Interchange File Format, so this is not a WAV marker at all — AVI and WebP open with exactly the same four bytes.
44RIFF chunk sizeLittle-endian unsigned 32-bit count of everything that follows, so the file length minus eight. A 176478-byte recording carries 56 B1 02 00 here, which is 176470. Nothing enforces it, and a wrong value is the single most common defect in hand-written WAV files.
84WAVE form type57 41 56 45. This is the field that actually says audio: an AVI has 'AVI ' here and a WebP has 'WEBP'. A detector that stops after checking RIFF at offset 0 cannot tell those three apart.
124'fmt ' chunk id66 6D 74 20 — note the trailing space, because every RIFF chunk id is exactly four bytes and 'fmt' is only three. The format chunk is required and by convention comes first.
164fmt chunk size16 for plain PCM, 18 when a two-byte extension size is appended, and 40 for WAVE_FORMAT_EXTENSIBLE. Anything other than 16 pushes every later chunk further down the file, which is why offset 36 is not a reliable landmark.
202Audio format code1 is uncompressed PCM, 3 is 32-bit IEEE float, 6 is A-law, 7 is mu-law, and FE FF (65534) is WAVE_FORMAT_EXTENSIBLE, where the real codec is named by a GUID inside the format extension instead.
222Channel count1 for mono, 2 for stereo, more for surround layouts. With extensible format a channel mask states which speaker each channel belongs to; a plain PCM WAV does not say, so channel order is convention only.
244Sample rateFrames per second, little-endian. 44100 appears as 44 AC 00 00 and 48000 as 80 BB 00 00. This is the only field a player uses to decide playback speed.
284Byte rateSample rate times channels times bits per sample divided by eight — 176400 for 44.1 kHz stereo 16-bit. It is fully derivable from the three fields around it, which makes it a free consistency check on a suspect header.
322Block alignBytes per sample frame: channels times bits per sample divided by eight, so 4 for 16-bit stereo. Seeking arithmetic uses it, so a wrong value turns every seek into a burst of noise.
342Bits per sample8, 16, 24 or 32. Eight-bit PCM is unsigned and everything wider is signed two's complement, a discontinuity that catches out anyone writing a converter from scratch.
364Next chunk idOnly in the minimal case is this the 'data' chunk. Encoders routinely put a 'LIST' INFO block or a 'fact' chunk first — a file written by one common encoder has 4C 49 53 54 here — so a parser must walk the chunk list rather than assume an offset.
variable4'data' chunk sizeThe four bytes immediately after the 64 61 74 61 chunk id, giving the number of sample bytes that follow. Being unsigned 32-bit, it is the origin of WAV's hard four-gigabyte ceiling.

Telling it apart from its neighbours

Easily confused withHow to tell
AVIIdentical for the first eight bytes: both are RIFF containers with a little-endian length at offset 4. The form type at offset 8 decides it — 57 41 56 45 for audio, 41 56 49 20 ('AVI ' with a trailing space) for video. This is the same trap that makes a naive 'starts with RIFF' check report video files as audio.
WebPThe third member of the RIFF family, with 57 45 42 50 at offset 8. So three completely unrelated media types share the same first eight bytes and differ only in one four-byte word, which is why any honest RIFF detector reads twelve bytes rather than four.
RF64 / BW64Recordings over four gigabytes cannot express their length in a 32-bit field, so the broadcast variants replace the id at offset 0 with 52 46 36 34 ('RF64') or 42 57 36 34 ('BW64'), set the size at offset 4 to FF FF FF FF, and add a 'ds64' chunk holding real 64-bit sizes. The rest of the file is an ordinary WAVE, which is why some players open them and others see a broken header.
FLACBoth are lossless, and people compare them constantly, but there is no ambiguity in the bytes: a native FLAC begins 66 4C 61 43 ('fLaC') followed by a 34-byte STREAMINFO block. A FLAC file renamed to .wav will not open anywhere, because no WAV reader scans for a form type.
MP3MP3 has no container at all. It begins either with an 'ID3' tag or directly with a frame sync — eleven set bits, so FF followed by a byte whose top three bits are set. Nothing about it resembles RIFF, and a .wav that starts FF FB is a mislabelled MP3.

How these files break

  • A crashed or force-quit recorder. The audio data is on disk but the two size fields — the RIFF size at offset 4 and the data chunk size — still hold whatever was written when recording started, often zero or a pre-allocated length. Players then stop early, or read past the samples into whatever follows. The repair is arithmetic: recompute both fields from the real file length and the file plays perfectly.
  • The four-gigabyte ceiling. Both size fields are unsigned 32-bit, so a long multitrack or field recording silently wraps and the header describes a file far smaller than the one on disk. RF64, BW64 and Sony's Wave64 all exist purely to escape this, and none of them is plain WAV.
  • Bit depth that disagrees with the samples. If offset 34 says 16 but the samples were written 24-bit, every frame boundary is wrong and the file plays as rhythmic static at roughly the right duration. The header is valid; it is simply describing different bytes than the ones present.
  • Missing chunk padding. RIFF requires odd-length chunks to be followed by a pad byte that is not counted in the chunk size. A writer that forgets it leaves every later chunk offset one byte low, so a reader lands mid-chunk and reports garbage chunk ids like 'ata\0'.
  • Prepended bytes. An HTML error page, a stray UTF-8 BOM or an email header saved ahead of the audio pushes RIFF off offset 0. Every sample survives; deleting everything before 52 49 46 46 restores the file exactly.

Where the format stands today

WAV is still the working format of audio production, and that is unlikely to change: it is lossless, every DAW and every operating system reads it, and the layout is simple enough that writing one from scratch takes a page of code. What it is not is a distribution format — an hour of CD-quality stereo is about 600 MB, so anything that leaves a studio gets encoded to AAC, Opus or MP3 first, and FLAC has taken over lossless distribution because it stores the same samples in roughly half the space with a real metadata model. WAV also remains the default for short system sounds, sample libraries, speech corpora and anything a microcontroller or a game engine has to play without a decoder, because raw PCM needs no CPU at all. Its two real limits are the four-gigabyte ceiling and the absence of a standard metadata scheme, and both are why broadcast work moved to RF64 and BWF.

Open WAV files on this site

Every one of these runs in your browser — the file never leaves your machine.

Related formats

Formats that are easy to confuse with WAV — compare their leading bytes.

FormatFirst bytesExtension
FLAC66 4C 61 43.flac
MP349 44 33.mp3
AVI52 49 46 46.avi
WebP52 49 46 46.webp

Frequently asked questions

What is a magic number in a file?

The first few bytes of a file, which identify its format regardless of what the name says. A PNG always starts with 89 50 4E 47; a ZIP with 50 4B 03 04. Operating systems, browsers and the file command all read these bytes rather than trusting the extension, which is why renaming a file does not change what it actually is.

How do I check a file's magic number myself?

On macOS or Linux, xxd -l 16 yourfile prints the first 16 bytes; on Windows, Format-Hex -Path yourfile -Count 16 in PowerShell. Or drop the file into the File Type Identifier on this site, which reads the bytes locally and names the format for you — nothing is uploaded.

Why do two formats share the same magic number?

Because one is built on the other. Every docx, xlsx, pptx, apk, jar and epub begins with the ZIP signature, since all of them are ZIP archives underneath; telling them apart means looking at the entries inside. Java class files and macOS universal binaries both start with CA FE BA BE and are distinguished by the field that follows.

Can a file have no magic number at all?

Yes. Text-based formats — XML, HTML, JSON, SVG, CSV — have no fixed byte signature, so they are recognized structurally instead: a leading <?xml declaration, a <svg element, or a { followed by a quoted key. That detection is a good guess rather than a certainty, which is why this reference marks those formats as probe-detected.

Does a matching magic number mean the file is safe?

No. It tells you what the format is, not whether the contents are harmless — a genuine PDF or docx can still carry a malicious payload. Identifying the true type is a useful first check, especially when the extension disagrees with the bytes, but it is not a malware scan.

Have a file that might be in the WAV format? Identify it with the File Type Identifier — it reads the magic number locally, nothing is uploaded. Or browse all formats.