Audio to Base64
Convert an MP3, WAV or other audio file into a Base64 data URL, and play it back to check.
Convert an MP3, WAV or other audio file into a Base64 data URL, and play it back to check.
data:audio/mpeg;base64,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.
<audio controls src="data:audio/mpeg;base64,SUQzBAAAAAAA..."></audio>
new Audio("data:audio/mpeg;base64,SUQzBAAAAAAA...").play();
{ "sound": "data:audio/wav;base64,UklGRiQAAABXQVZF..." }
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.
Choose the MP3 file. The data:audio/mpeg;base64,... string appears straight away; click Copy.
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.
No. The file is read locally with the FileReader API and never leaves your browser.