Audio to Base64

Convert an MP3, WAV or other audio file into a Base64 data URL, and play it back to check.

What you can do here

How audio to Base64 works

The browser reads the file with FileReader.readAsDataURL() and writes its bytes as Base64 text behind a MIME-type header such as data:audio/mpeg;base64, for MP3 or data:audio/wav;base64, for WAV. Every 3 bytes become 4 characters, so the text is about a third larger than the file: a 3-minute MP3 of 3 MB becomes roughly 4 million characters. That suits short sound effects, UI clicks and voice notes better than music.

Using the output

<audio controls src="data:audio/mpeg;base64,SUQzBAAAAAAA..."></audio>

new Audio("data:audio/mpeg;base64,SUQzBAAAAAAA...").play();

{ "sound": "data:audio/wav;base64,UklGRiQAAABXQVZF..." }

Common questions

Can I play the Base64 audio back directly in a browser?

Yes. Put the data URL in the src of an <audio> element or pass it to new Audio(). The player on this page does exactly that so you can check the result.

How do I convert an MP3 to Base64?

Choose the MP3 file. The data:audio/mpeg;base64,... string appears straight away; click Copy.

Why is the Base64 text so much larger than my audio file?

Base64 turns every 3 bytes into 4 characters, about 33% overhead. Long recordings produce millions of characters, so link to the file instead for anything long.

Does this tool upload my audio anywhere?

No. The file is read locally with the FileReader API and never leaves your browser.