D

Base64 Encode / Decode

Encode text or binary to Base64 and decode it back — with full UTF-8 support.

Runs 100% in your browser — nothing is uploaded

About this tool

Base64 encoding converts binary data — or any text — into an ASCII string that is safe to transmit through systems that handle only text, such as email SMTP, HTML data URIs, HTTP Basic Auth headers, and JSON payloads. This tool encodes any text input to Base64 and decodes any Base64 string back to the original text, with full UTF-8 support for non-ASCII characters.

A common pitfall with Base64 in JavaScript is that the built-in btoa() function does not handle Unicode strings above code point 127 — it throws "invalid character" errors. This tool uses a proper UTF-8 encode/decode pipeline so you can safely round-trip emoji, Chinese characters, Arabic text, and any other Unicode content.

Everything runs in your browser with zero network requests. The tool shows the raw Base64 string, the byte length of both the original and encoded forms, and validity feedback when a decode input contains invalid characters. Use Swap to toggle between encode and decode mode, Copy to grab the output, and Paste Sample to see an example.

Frequently asked questions

Does Base64 encrypt my data?
No. Base64 is an encoding scheme, not encryption. Anyone who sees the Base64 string can trivially decode it back to the original. Do not use Base64 to "hide" sensitive data.
Why is Base64 output always longer than the input?
Base64 encodes every 3 bytes of input into 4 ASCII characters, increasing size by approximately 33%. This overhead is the cost of ASCII-safe representation.
What is URL-safe Base64?
Standard Base64 uses + and / characters, which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ to make the string safe for URL path segments and query parameters. JWTs use URL-safe Base64.
Why do I get "invalid character" errors when decoding?
The input may contain characters that are not valid Base64 (spaces, line breaks, or non-Base64 characters). This tool strips whitespace automatically before decoding, but other invalid characters will produce an error.