MP3 to Base64 Converter
ED-71Open an MP3 file and get its Base64 text as a data URI, as plain Base64 or inside a ready audio tag. A built-in player lets you check that the audio is the one you meant.
Runs in your browser. Nothing is uploaded.
Audio file (MP3)
Base64
How to use it
- Drop an audio file on the left box or press Open file. MP3 is the main case; WAV, Ogg, FLAC, AAC and M4A also work.
- Choose Data URI, Base64 only or HTML audio tag.
- Press play in the preview to confirm the sound, then check the size line.
- Copy the text or download it as a .txt file.
What the output looks like
A data URI for an MP3 starts with data:audio/mpeg;base64, and continues with the encoded bytes. Put it in the src of an audio element, in a JavaScript Audio object or in a JSON file. The audio tag choice writes <audio controls src="..."></audio> so you can paste a working player. Base64 only gives the bare text without the prefix, in one line or wrapped at 64 or 76 characters.
The file is not decoded or changed
The tool reads the bytes and encodes them. It does not decode the sound or re-encode it, so quality, bitrate and tags such as the title and cover art stay exactly as they are in the source file. The type in the data URI comes from the first bytes of the file; the file name is used only when the bytes are not recognized, and the tool tells you when that happens.
Size and when to avoid it
Base64 adds about a third to the size, and an audio data URI sits inside the page or script that holds it, so it is downloaded with that file and cannot be cached on its own. It suits short sound effects and small clips. For music or long recordings, link to the audio file instead. Files over 10 MB are refused.
Error messages and what to do
| Message | What it means | Fix |
|---|---|---|
The file is empty. | The file has zero bytes. | Choose a different file. |
This does not look like audio. Its first bytes match this type: … | The file starts like a PDF, ZIP, text or another non-audio format. | Open the real audio file. |
This file is not recognized as audio. It starts with the bytes … | The first bytes match no known audio format and the file name has no audio extension. | Check the file, or rename it with its real extension such as .mp3. |
Questions people ask
How do I convert an MP3 to Base64?
Drop the MP3 on the left box or press Open file. The Base64 appears right away as a data URI. Switch the output to Base64 only or HTML audio tag if you need those, then press Copy.
How do I play an audio data URI?
Put it in the src of an audio element, for example <audio controls src="data:audio/mpeg;base64,..."></audio>, or pass it to new Audio() in JavaScript. The audio tag output choice writes the first form for you.
Does Base64 change the audio quality?
No. The bytes of the file are encoded as they are and nothing is decoded or compressed again, so the sound is identical. The text is about a third larger than the file because of how Base64 works.
Can I convert WAV or OGG files too?
Yes. The type is read from the file content, so WAV, Ogg, FLAC, AAC and M4A files get the matching audio type in the data URI. Whether the preview plays depends on what your browser supports.
Why is there a 10 MB limit?
A 10 MB file becomes about 13 MB of text, which is already heavy for a text box and for any page that carries it. For long audio, host the file and link to it instead of embedding it.
How do I get the audio back from Base64?
Use the Base64 text with a decoder such as atob in JavaScript or base64 -d on the command line and save the bytes with an .mp3 extension. This site's Base64 to Image converter handles pictures only.
About this tool
Reads the audio file in your browser and writes its bytes as Base64 without decoding or re-encoding them, so tags such as the title and cover art stay in the file. The type comes from the first bytes: MP3 is the main target, and WAV, Ogg, FLAC, AAC and M4A files are accepted and labeled with their own audio type. Only when the bytes are not recognized is the type taken from the file name. Files over 10 MB are refused. The sample is a short silent MP3 made in the page. The player uses your browser, so it can only play formats your browser supports. Line breaks apply to the Base64 only output.