Base64 Encode/Decode
Encode text or files to Base64 and decode it back - fully Unicode-safe, with a URL-safe option. Everything runs in your browser.
Encode a file to a data URI
How Base64 encoding works
Base64 takes three bytes of data at a time - that is 24 bits - and splits them into four
6-bit groups. Each group indexes into a 64-character alphabet (A-Z, a-z, 0-9, plus +
and /), producing four printable characters. When the input length is not a
multiple of three, one or two = characters pad the end. The result is safe to move
through systems that only understand plain text.
Unicode done right
The browser's built-in btoa() only handles Latin-1 bytes, so it throws on anything
like an emoji or an accented letter. This tool instead runs your text through a
TextEncoder to get proper UTF-8 bytes before encoding, and a
TextDecoder on the way back. That means cafe with an accent, a Chinese
character or a rocket emoji all encode and decode losslessly.
Data URIs from files
Drop a file into the box and you get a data: URI: the file's MIME type, the
base64 marker, then the encoded bytes. Paste that straight into an
<img src>, a CSS background-image or a stylesheet to embed a
small icon without a separate network request. Keep it to small assets - the 33% size overhead
makes it a poor fit for large images. For those, use the dedicated
image to Base64 tool with its ready-made HTML and CSS snippets.
Related developer tools: the URL encoder for query-string safety, the JWT decoder (JWTs are three Base64url segments), and the hash generator when you need a one-way transform rather than a reversible one.