MP3 to Base64 Converter

Drop an MP3 to get a Base64 string for an HTML audio tag, a JavaScript Audio object, or a JSON request body. Before encoding, the page reads the MPEG frame header and the ID3 tag, so you see the bitrate, the length, and how many bytes cover art adds to the string. The file stays on your device.

Drop an MP3 here

Up to 50 MB. Nothing uploads.

Options
File-
Encoded bytes-
Output length-
Tags removed-

How long will the string be?

Base64 writes 4 characters for every 3 bytes. An MP3 spends a fixed number of bytes per second, set by its bitrate. Multiply the two and you know the string length before you encode anything.

SoundBitrateMP3 bytesBase64 characters
Button click, 0.3 s96 kbps3,6004,800
Notification chime, 2 s128 kbps32,00042,668
Radio jingle, 30 s128 kbps480,000640,000
Song, 3 min192 kbps4,320,0005,760,000
Podcast episode, 1 h64 kbps28,800,00038,400,000

Rule of thumb: at 128 kbps, each second of audio adds about 21,300 characters. The table counts audio frames only. A song bought from a music store often carries a 50 to 500 KB cover image in its ID3 tag, which turns into another 67 to 667 KB of text. With Strip ID3 tags on, none of those bytes reach the output.

What Strip ID3 removes, and what stays

Removed

  • The ID3v2 block at the start of the file: title, artist, album, lyrics, ReplayGain values, and embedded cover art (APIC frames). Some files carry two of these blocks back to back. Both go.
  • The ID3v1 trailer, the last 128 bytes, which start with the letters TAG.

Kept

  • The Xing, Info, or VBRI header inside the first audio frame. Browsers read the frame count from this header to show the right duration for VBR files and to seek. Without the header, the progress bar breaks.
  • APEv2 and Lyrics3 tags. These sit between the audio and the ID3v1 trailer, and the page does not cut them. Expect a few hundred extra bytes from files tagged this way.

Players skip tags, so stripping changes nothing you hear. The readout on the left shows the tag size and the cover art size before you decide.

Pick the output for where the string lands

Data URI

The full data:audio/mpeg;base64, form. Paste the string into a src attribute, a CSS custom property, or a fetch call.

The MIME type is audio/mpeg, the registered type for MP3 under RFC 3003. Plenty of tutorials write audio/mp3. Chrome and Firefox accept the label, but the type is not registered and HTML validators flag the tag.

Raw

The string with no prefix. Speech services such as Google Cloud Speech-to-Text want this form in the content field of a JSON request. Turn on the URL-safe alphabet for query strings or file names. Turn on 76-character wrapping for a MIME email body (RFC 2045). JSON and data URIs must stay on one line.

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

A drop-in tag for a single-file HTML demo or an offline help page.

JS
const clip = new Audio("data:audio/mpeg;base64,//uQxAAAAAAA...");
document.querySelector("#send").addEventListener("click", () => clip.play());

Browsers block play() until the visitor clicks or taps on the page, so trigger playback from an event handler, as above. A call on page load throws a NotAllowedError.

JSON

An object with the file name, mimeType, byte count, and data. Rename the keys to match your API before sending.

When to skip Base64 and serve the file

Inlining audio trades caching for one fewer request. For most sounds bigger than a click, the trade loses.

  • Anything past about 100 KB inside HTML or CSS. Every page view downloads the full string again, and the browser holds the text plus the decoded bytes in memory. A separate MP3 file gets cached once.
  • Songs and podcasts. A data URI has no range requests. The player decodes the whole string before playback, where a hosted file starts streaming after the first few kilobytes.
  • Email. Gmail and Outlook drop the audio element. Attach the MP3 instead.
  • UI sounds under 20 KB, such as clicks, chimes, and error beeps. One fewer request, no flash of silence on first use.
  • Single-file deliverables: a self-contained HTML report, a CodePen, a browser extension popup.
  • JSON APIs with no multipart upload, such as most speech-to-text and audio classification endpoints.

Server compression with gzip or Brotli wins back most of the 33% on the wire, since Base64 text compresses well. Memory use in the browser stays at the full size.

Encode or decode without a browser

The page accepts files up to 50 MB. For anything bigger, or for a build script, use the command line.

# Linux (GNU coreutils), one line, no breaks
base64 -w 0 chime.mp3 > chime.b64

# macOS
base64 -i chime.mp3 -o chime.b64

# Back to MP3
base64 -d chime.b64 > chime.mp3          # Linux
base64 -D -i chime.b64 -o chime.mp3      # macOS

Decoding a string in code:

// Browser, from a data URI
const blob = await (await fetch(dataUri)).blob();

// Node.js, from a raw string
fs.writeFileSync("chime.mp3", Buffer.from(b64, "base64"));

# Python
open("chime.mp3", "wb").write(base64.b64decode(b64))

A quick sanity check on any string: Base64 output starting with SUQz is the text ID3, so the file opens with a tag. Output starting with // opens straight on an MPEG frame header, so the tag is gone.

MP3 to Base64 questions

Short answers about tags, length, and file types.

Does stripping ID3 tags lower the audio quality?

No. The tool cuts the tag block at the start and the 128-byte trailer at the end. Every MPEG audio frame stays byte for byte the same, so the sound is identical.

Why does the duration here differ from my media player?

For a VBR file with no Xing or VBRI header, the page has no frame count and estimates length from the first frame bitrate. VBR bitrates swing, so the estimate drifts. The player under the file card reads the real length after decoding the string.

Should the MIME type be audio/mpeg or audio/mp3?

Use audio/mpeg. RFC 3003 registers audio/mpeg for MP3. audio/mp3 plays in most browsers but is not a registered type, and HTML validators report it.

What happens with a WAV, OGG, or M4A file?

The page finds no MPEG frame, says so, and encodes the file with its own MIME type. The frame readout and tag stripping stay off. No other format gets a frame check here.

Does this page decode Base64 back into an MP3?

No, this page encodes only. Paste the string into the Base64 to Audio tool to play or download the MP3, or run base64 -d on the command line.

Why does the output box show only part of the string?

Past 200,000 characters, the box shows the opening part, because a textarea holding millions of characters freezes some browsers. Copy output and Download always deliver the full string.