MP3 to Base64 Converter

Encode MP3, WAV, OGG, M4A or FLAC into Base64 and a working HTML audio tag.

Your files are processed on your device and are never uploaded.

Encode an MP3 – or WAV, OGG, M4A, FLAC, AAC or Opus – into Base64 and get a working HTML <audio> tag with the sound built in. Useful for notification sounds in a web app, audio in a single-file HTML page, or sending a clip through an API that only accepts text.

MP3 to Base64 Converter with ShrinkBee

How to Convert Audio to Base64

  1. Choose the audio file. You can play it in the preview to check it is the right one.
  2. Copy what you need: the raw Base64, the data URI (data:audio/mpeg;base64,…) or the complete <audio controls> tag.
  3. Paste it into your HTML, JavaScript or JSON.

Using It in JavaScript

A data URI works anywhere a URL does, so a short UI sound can be played without loading a file:

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

Browsers only play sound after the user has interacted with the page, so trigger it from a click or key press.

Keep Clips Short

Base64 adds about a third to the size, and the whole string has to load before the page can use it. A one-second click sound at 128 kbps is around 16 KB – perfect for inlining. A three-minute song would become several megabytes of text inside your page, which is better served as a normal file.

To make a clip smaller first, cut it with Audio Cutter and lower the bitrate with MP3 Bitrate Changer – 64 kbps mono is plenty for alerts and voice prompts.

Which Format to Encode?

  • MP3 plays in every browser – the safest choice.
  • M4A/AAC sounds better at low bitrates and plays in all current browsers.
  • OGG/Opus is very efficient but older Safari versions do not support it.
  • WAV is uncompressed and gets very large – avoid it for inlining.

Private

The file is encoded in your browser and never uploaded. To turn Base64 back into an audio file, use Base64 to File.

Base64 to File Video to Base64 File to Base64 Cut Audio MP3 Bitrate Changer

Frequently Asked Questions

How do I convert MP3 to Base64?
Choose the MP3 file. The Base64 string, data URI and an HTML audio tag appear – copy the one you need.
How do I play a Base64 MP3 in HTML?
Use the data URI as the source: <audio controls src="data:audio/mpeg;base64,…"></audio>. The tool gives you this tag ready-made.
Which audio formats are supported?
MP3, WAV, OGG, M4A, FLAC, AAC and Opus.
Is there a size limit?
There is no fixed limit, but long files make huge strings. Inline only short clips and serve long audio as a normal file.
How do I convert Base64 back to MP3?
Paste the string into Base64 to File and download the audio file.
Is MP3 to Base64 free to use?
Yes. MP3 to Base64 is completely free, with no sign-up, no watermark and no limit on how many times you use it.
Are my files uploaded to a server?
No. Your files are processed directly in your web browser on your own device. Nothing is uploaded or stored, and the file is gone from memory when you close the tab.

More Base64 Tools

Made With ♥ By ShrinkBee