Audio to Base64
Encode any audio file as a Base64 data URI.
Drag & drop a file here, or click to browse
Drop a WAV, OGG, Opus, M4A, AAC, FLAC, or MP3 file. Max 15 MB, converted in your browser.
Audio to Base64 Converter
Encode any sound file — WAV, OGG, Opus, M4A, AAC, FLAC, WebM, or MP3 — into a Base64 string or a data URI with the correct audio MIME type. The built-in player lets you check the result immediately, and nothing is uploaded.
How the MIME type is chosen
The tool uses the type your browser reports for the file, and if that's missing it inspects the first bytes. Typical data URI prefixes are:
data:audio/wav;base64,UklGR...– WAV (RIFF container withWAVEinside)data:audio/ogg;base64,T2dnUw...– Ogg Vorbis or Ogg Opus (OggSheader)data:audio/flac;base64,ZkxhQw...– FLAC (fLaCheader)data:audio/mp4;base64,...oraudio/x-m4a– AAC or ALAC in an M4A containerdata:audio/webm;base64,GkXfo...– WebM audio recorded byMediaRecorder
Picking the right format
WAV stores raw PCM samples. It's universally playable and has zero decoding delay, which is good for very short sound effects, but it's large. FLAC is lossless and about half the size of WAV. Opus (in Ogg or WebM) gives excellent quality at 24–64 kbps and is ideal for voice. AAC/M4A is the default on Apple devices and plays everywhere. Remember that Base64 adds roughly a third on top of whatever size you start with.
Common use cases
- Sending microphone recordings from a browser to a speech recognition or AI API that expects Base64 audio in JSON.
- Embedding notification sounds in a single-file web app, game, or browser extension.
- Storing short voice notes in a database text column or local storage.
- Preparing test fixtures for audio upload endpoints.
Playing the result
Paste the data URI into <audio controls src="...">, or use it in JavaScript with new Audio(uri).play(). The Web Audio API can decode it too after fetching the URI into an ArrayBuffer.
If you only work with MP3 files, the dedicated MP3 to Base64 page explains ID3 tags and bitrates. For images, use Image to Base64.
Frequently Asked Questions
Which audio formats can I convert?
Any audio file works: MP3, WAV, OGG/Vorbis, Opus, M4A/AAC, FLAC, WebM audio, and more. The Base64 encoding itself is format-independent; whether the preview plays depends on your browser's codec support.
Why is the preview silent for my file even though the output looks fine?
The browser may not support that codec — for example Safari has limited Ogg Vorbis support in older versions and some browsers can't play ALAC in M4A. The Base64 data is still correct and will play in an environment that supports the format.
Which audio format gives the shortest Base64 string?
Opus is the most efficient for both speech and music, followed by AAC and MP3. Uncompressed WAV is the largest — around 10 MB per minute of CD-quality stereo — and FLAC is lossless but still several times bigger than lossy formats.