How to use the Audio to Base64 tool
- Select the File field and pick a recording. The picker lists audio types such as MP3, WAV, Ogg, M4A and FLAC.
- Select Encode file to read and encode the audio.
- Wait for Done to appear, then find the Base64 in the Result box.
- Select Copy, or select Download to get a text file named like your recording with .base64 appended.
How audio to Base64 encoding behaves
The encoder treats the recording as a byte sequence. It does not parse frames or samples, so the codec, bitrate, sample rate, channel layout and tags such as ID3 cover art all end up in the Base64 unchanged. Decoding the string gives a file identical to the one you chose.
The Result is standard Base64 with padding on one line. It has no data: prefix. That matches what most speech APIs expect in a JSON body: a field holding only the encoded audio, with the format named in a neighboring field.
How much audio fits in 20 MiB
The tool refuses files over 20 MiB (20,971,520 bytes). How long a recording that allows depends entirely on the format. The Base64 itself is one third larger than the file, so a 20 MiB recording becomes almost 28 million characters.
- MP3 at 128 kbit/s uses 16,000 bytes per second: about 21 minutes 50 seconds.
- MP3 at 320 kbit/s uses 40,000 bytes per second: about 8 minutes 44 seconds.
- WAV at 16 kHz, 16-bit mono, typical for speech recognition, uses 32,000 bytes per second: about 10 minutes 55 seconds.
- WAV at CD quality uses 176,400 bytes per second: just under 2 minutes.
Worked example: a 52 byte WAV
A tiny WAV file, tone.wav, holds a 44 byte header and eight 8-bit samples of silence. Encoding it gives 72 characters. They start with UklGR, the Base64 form of the RIFF marker that opens every WAV, and the download is offered as tone.wav.base64. Pasting the string into Base64 to WAV returns the original 52 bytes.
tone.wav (52 bytes)
UklGRiwAAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQgAAACAgICAgICAgA==
As a data URL:
data:audio/wav;base64,UklGRiwAAABXQVZF...Using Base64 audio in code
In a web page, a data URL can feed an audio element directly: data:audio/mpeg;base64, for MP3, data:audio/wav;base64, for WAV and data:audio/ogg;base64, for Ogg. For the Web Audio API, decode the string to an ArrayBuffer and pass it to decodeAudioData. Both suit short interface sounds in a single-file page.
Longer audio is better served as a normal file. An inlined clip cannot be streamed or cached separately, and the browser must hold the whole string in memory before playback begins.
Frequently asked questions
Is my recording uploaded to convert it?
No. The audio file is opened by your browser and encoded in the page. Voice memos, interviews and call recordings stay on your device.
Which audio formats can I encode?
Any. The picker is filtered to audio files, and the encoder works on raw bytes, so MP3, WAV, Ogg, Opus, M4A, AAC and FLAC are all handled the same way.
Does converting audio to Base64 reduce quality?
No. Nothing is re-encoded. Base64 only rewrites the existing bytes as text, and decoding restores them exactly.
Why is my file rejected as too large?
The limit is 20 MiB per file. Uncompressed WAV reaches it within minutes. Convert the recording to a compressed format or trim it, then encode the smaller file.
How do I play Base64 audio in HTML?
Add the matching prefix to the string and use it as the src of an audio element, for example a value that starts with data:audio/mpeg;base64, for an MP3. Add the controls attribute to show a player.