Base64 Encoder & Decoder

Encode text or files to Base64, or decode Base64 back to text or bytes. UTF-8 safe — emoji and non-Latin characters round-trip correctly. URL-safe variant for use in JWTs and URL parameters. Runs entirely in your browser.

What Base64 is for

Base64 encodes arbitrary binary data into a 64-character ASCII alphabet (A-Z, a-z, 0-9, +, /). Every three bytes become four characters; the result is text that survives any channel that drops or mangles non-printable bytes — email, URLs, JSON strings, source code literals. The size cost is ~33% (3 bytes → 4 ASCII characters).

Common places you'll see Base64: inline images in HTML/CSS (data:image/png;base64,...), Basic Auth headers (Authorization: Basic <base64(user:pass)>), JWT payload segments (URL-safe variant), email attachments (MIME), TLS certificates (PEM is Base64 of DER bytes), and SSH public keys.

UTF-8 handling explained

Naive Base64 of a non-ASCII string in JavaScript fails because btoa() treats input as Latin-1 code units. This tool encodes the UTF-8 bytes — the same byte sequence a server-side Base64 of the same string would produce in Python, Go, Java, or any other UTF-8-default environment. The result round-trips through any other UTF-8-respecting tool.

Frequently asked questions

What's the difference between standard and URL-safe Base64?

Standard Base64 uses + and / as the 62nd and 63rd characters, which need percent-encoding in URLs. URL-safe Base64 (RFC 4648 §5) uses - and _ instead, plus typically omits the = padding. JWTs use URL-safe Base64 without padding.

Why does my Base64 of an emoji come out wrong elsewhere?

Most likely a UTF-8 vs UTF-16 issue. This tool encodes the bytes of the UTF-8 representation, which is the de-facto standard. Some other tools (legacy JS btoa used naively) encode UTF-16 code units, which corrupts non-Latin characters. If you got Base64 from such a source, decoding it here will show garbled text — re-encode at the source.

Can I Base64-encode a file?

Yes — switch to File mode, drop the file, and copy the encoded output. Files up to ~25 MB encode comfortably in the browser; larger files lag the tab.

Is Base64 encryption?

No. Base64 is encoding — it converts binary to ASCII so it can travel through text-only channels. Anyone with the Base64 string can decode it back to the original bytes with no key. For confidentiality, use real encryption (AES) on top.