Upload a file
  1. base64hub
  2. File tools
  3. Audio to Base64

Audio to Base64

Drop a sound file and get a data:audio/...;base64, URI for an <audio> tag or new Audio(), or plain Base64 for an API. A player above the output lets you check it is the right clip.

Free no sign-up, no limits Local nothing uploaded Updated Oct 27, 2026
Drop files here, paste, or pick them
Input –Output –Size –

Processed in your browser. This page cannot send your data anywhere – how we know

How to convert audio to Base64

  1. Drop an audio file on the box or pick one or more with the file picker. MP3, WAV, OGG, M4A, AAC and FLAC all work.
  2. Play it in the preview to make sure it is the clip you want.
  3. Output as starts on Data URI. Choose Plain Base64 for an API, or JSON for name, type, size and data together.
  4. Press Copy output. For long recordings use Save as .txt.

Recognizing audio formats in Base64

FormatMIME typeBase64 starts with
MP3 with ID3 tagaudio/mpegSUQz
MP3 without tagaudio/mpeg// and a letter, e.g. //uQ
WAVaudio/wavUklGR, with XQVZF at characters 12–16
Ogg (Vorbis, Opus)audio/oggT2dnUw
FLACaudio/flacZkxhQw
M4A (AAC)audio/mp4AAAA + one character + GZ0eXBNNEEg
WebM audioaudio/webmGkXfo

The data URI uses the MIME type your browser reports for the file. If it reports none, the tool picks one from the extension. MP3 and AAC in M4A play in every current browser; Ogg, FLAC and WebM support is good but less universal, so test the formats your users have.

Where Base64 audio is useful

  • Clicks, notification chimes and short game effects can be inlined in a single HTML file, so the page or game runs from one file without a server.
  • Speech-to-text, translation and audio-analysis services often accept a recording as Base64 in a JSON field, together with its encoding and sample rate.
  • A short sample stored as a Base64 constant lets you test an audio pipeline without a binary file in the repository.

For music, podcasts or anything longer than a few seconds on a website, link the file. Browsers stream a linked file and fetch it in ranges, while a data URI has to be in memory in full before playback starts.

How big encoded audio gets

Base64 is 4/3 of the file size, so the length follows the bitrate:

Audio10 secondsBase64
MP3, 128 kbps160,000 bytes213,336 chars
WAV, 16 kHz mono 16-bit (speech)320,044 bytes426,728 chars
WAV, 44.1 kHz stereo 16-bit (CD)1,764,044 bytes2,352,060 chars

A minute of CD-quality WAV is over 14 million characters of Base64. Format-specific details are on MP3 to Base64 and WAV to Base64, and Base64 to Audio plays or saves a Base64 string you received.

Play Base64 audio in JavaScript

const beep = new Audio("data:audio/mpeg;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2...");
button.addEventListener("click", () => beep.play());

Browsers block audio that starts without a user gesture, so call play() from a click or key handler. Decoding and other variants are covered in Base64 in JavaScript.

FAQ

How do I play Base64 audio in HTML?

Put the data URI in the src of an <audio> element: <audio controls src="data:audio/mpeg;base64,SUQz..."></audio>. In JavaScript, new Audio(dataUri).play() works the same way, as long as it runs after a user interaction.

Which audio format gives the shortest Base64?

A compressed one. Per second of sound, MP3, AAC (M4A) and Opus are many times smaller than WAV or FLAC, and Base64 adds the same third to each. For speech, a low bitrate mono file is shortest.

Can I convert several sound files at once?

Yes. Drop them together, pick one in the list with Show, or use Copy all as JSON to get every file’s name, type, size and Base64 in one array. That suits a sound map in a small game.