Audio to Base64 Converter
Convert audio files (MP3, WAV, OGG, FLAC) to Base64 encoded strings and decode Base64 back to audio files. Free, instant, client-side.
About
Base64 encoding transforms binary audio data into an ASCII string using a 64-character alphabet (A - Z, a - z, 0 - 9, +, /). This is required when embedding audio directly into HTML, CSS, JSON payloads, or email bodies where raw binary transport is not supported. The encoding inflates file size by approximately 33% (every 3 input bytes produce 4 output characters), so a 1MB MP3 yields roughly 1.33MB of text. Incorrect encoding or truncated strings will produce silent or corrupted playback with no browser error, making validation critical before deployment.
This tool performs real conversion entirely in your browser using the native FileReader API. No data leaves your machine. It supports encode (audio file → Base64 string) and decode (Base64 string → downloadable audio file) operations. Note: browser memory limits processing to files under approximately 50MB. For lossless formats like WAV or FLAC, expect proportionally larger output strings.
Formulas
Base64 encoding maps every group of 3 input bytes (24 bits) to 4 printable ASCII characters (6 bits each). The output length is computed as:
Where Lin = input file size in bytes, and Lout = number of Base64 characters. The size ratio converges to:
The Data URI format prepends a header: data:mimeType;base64,encodedData. For decoding, the reverse operation extracts the raw Base64 string after the comma, converts each character back to its 6-bit index, reconstructs 8-bit byte groups, and outputs a binary Blob.
Where R = size inflation ratio, Lin = input byte count, Lout = Base64 character count, ceil = ceiling function (round up to nearest integer).
Reference Data
| Audio Format | MIME Type | Typical Bitrate | 1 min File Size (approx.) | Base64 Output Size (approx.) | Browser Support |
|---|---|---|---|---|---|
| MP3 | audio/mpeg | 128 - 320 kbps | 0.96 - 2.4 MB | 1.28 - 3.2 MB | All modern |
| WAV | audio/wav | 1411 kbps (16-bit/44.1kHz) | 10.1 MB | 13.5 MB | All modern |
| OGG Vorbis | audio/ogg | 96 - 500 kbps | 0.72 - 3.75 MB | 0.96 - 5.0 MB | Chrome, Firefox, Edge |
| FLAC | audio/flac | 600 - 1200 kbps | 4.5 - 9.0 MB | 6.0 - 12.0 MB | Chrome, Edge, Firefox 51+ |
| AAC | audio/aac | 96 - 256 kbps | 0.72 - 1.92 MB | 0.96 - 2.56 MB | Chrome, Safari, Edge |
| WebM (Opus) | audio/webm | 64 - 510 kbps | 0.48 - 3.83 MB | 0.64 - 5.1 MB | Chrome, Firefox, Edge |
| M4A (MPEG-4) | audio/mp4 | 128 - 256 kbps | 0.96 - 1.92 MB | 1.28 - 2.56 MB | Chrome, Safari, Edge |
| AIFF | audio/aiff | 1411 kbps | 10.1 MB | 13.5 MB | Safari; limited elsewhere |
| MIDI | audio/midi | N/A (event data) | 10 - 100 KB | 13 - 133 KB | No native playback |
| WMA | audio/x-ms-wma | 128 - 192 kbps | 0.96 - 1.44 MB | 1.28 - 1.92 MB | Not supported natively |
| Base64 Character Set Reference | |||||
| Index 0-25 | A B C D E F G H I J K L M N O P Q R S T U V W X Y Z | ||||
| Index 26-51 | a b c d e f g h i j k l m n o p q r s t u v w x y z | ||||
| Index 52-61 | 0 1 2 3 4 5 6 7 8 9 | ||||
| Index 62-63 | + / (padding: =) | ||||
Frequently Asked Questions
data:audio/mpeg;base64, followed by the encoded data. Raw Base64 is just the encoded string without this prefix. Use Data URIs when embedding in HTML <audio> tags or CSS. Use raw Base64 when storing in JSON fields or databases where the MIME type is tracked separately.audio/mpeg). (2) The Base64 string is truncated or contains line breaks that were not removed. (3) The browser does not support the codec (e.g., Safari cannot play OGG Vorbis natively). Always validate the string with this tool's preview player before embedding.