How to decode Base64 to WAV
- Paste the Base64 into Base64 or data URI. A
data:audio/wav;base64,ordata:audio/x-wav;base64,prefix is fine. - Play it in the player. Duration shows the length in minutes and seconds.
- Press Show hex dump to see the first 512 bytes; the next section explains what to look for.
- Press Download file to save the .wav.
Decoding and playback run in the browser. The page may not send data over the network except Cloudflare’s page-view count, so speech recordings stay on your device.
Reading the WAV header in the hex dump
A WAV file starts with a 12-byte RIFF header, usually followed directly by the fmt chunk that describes the audio. In the hex dump, these positions tell you what you have:
| Offset (hex) | Bytes | Field | Example: 16 kHz mono PCM |
|---|---|---|---|
00 | 4 | RIFF | 52 49 46 46 |
08 | 4 | WAVE | 57 41 56 45 |
14 | 2 | Format code | 01 00 |
16 | 2 | Channels | 01 00 (mono) |
18 | 4 | Sample rate | 80 3e 00 00 (16,000) |
22 | 2 | Bits per sample | 10 00 (16) |
All numbers are little-endian, so 80 3e 00 00 is 0x3e80, which is 16,000. The format code decides whether the browser can play the file:
| Format code | Codec | Plays in Chrome |
|---|---|---|
01 00 | PCM | Yes |
03 00 | 32-bit float | Yes |
06 00, 07 00 | A-law, µ-law (telephony) | Yes |
02 00, 11 00 | Microsoft ADPCM, IMA ADPCM | No |
31 00 | GSM 6.10 | No |
fe ff | Extensible: the real codec is named later in the chunk, usually PCM | Yes for PCM |
Every browser plays PCM, but support for the other codecs differs, so test in the browser your listeners use. When the browser cannot decode a file, the note “Your browser can’t play this WAV file.” appears and Duration shows n/a. The download is still the correct file, and desktop players such as VLC handle all of these codecs.
The length follows from the header too: duration is the size of the data chunk divided by sample rate × channels × bytes per sample. Two seconds of 16 kHz mono 16-bit audio is 64,000 bytes of samples plus a header of at least 44 bytes.
Raw PCM without a header
Speech and voice APIs often return audio as bare 16-bit PCM samples at 16 or 24 kHz, with no RIFF header. Those bytes carry no signature, so the tool reports “This doesn’t look like WAV (detected: Binary)” and nothing will play them, even when saved with a .wav extension. Wrap them in a header using the sample rate, channel count and sample size from the API documentation:
import base64, wave
with open("speech.b64") as f:
pcm = base64.b64decode(f.read())
with wave.open("speech.wav", "wb") as w:
w.setnchannels(1)
w.setsampwidth(2)
w.setframerate(24000)
w.writeframes(pcm)
setsampwidth(2) means 16-bit samples. Two seconds of 24 kHz mono audio, 96,000 bytes of PCM, becomes a 96,044-byte WAV that starts with UklGR and plays here and in any player. If the result sounds too fast, too slow or like noise, the sample rate or the sample format is wrong; try the other common rates or check whether the API sends 8-bit µ-law instead. More on Base64 in Python.
Other formats on a WAV page
If the data is a different audio format, the tool names it: “This looks like MP3, not WAV.” comes with a Download as .mp3 button, and the player works anyway. WAV files are large, so APIs and apps often switch to MP3 or Opus to save space, while documentation still says WAV. For the size difference and for encoding WAV files, see WAV to Base64; for all audio formats, Base64 to audio.
FAQ
How do I convert Base64 to a WAV file?
Paste the Base64 above and press Download file; the audio is saved as decoded.wav. Play it first in the player to make sure it is what you expect.
My Base64 should be a WAV but the tool says Binary. Why?
A WAV file starts with RIFF (UklGR in Base64). Without it you most likely have raw PCM samples, which many speech APIs return; add a header with the sample rate from the API documentation, as shown on this page.
Why does one WAV play and another one does not?
WAV is a container, and the codec is a number in its header. Plain PCM plays everywhere; ADPCM and GSM, common in old telephony and voicemail systems, usually do not play in browsers. Convert those with ffmpeg -i in.wav -c:a pcm_s16le out.wav.