Base64 Encoder & Decoder
Convert text to Base64 and back β URL-safe variant included, with full Unicode support.
About This Tool & Technical Logic
Base64 represents arbitrary binary data using 64 printable characters, making it safe to embed in JSON, XML, URLs, and data URIs where raw bytes can't travel. Every 3 bytes become 4 characters, so output is ~33% larger than input.
Encoding is UTF-8 safe: text is first encoded to bytes, then Base64 β so emoji and non-Latin scripts round-trip correctly, which naive btoa() implementations get wrong. The URL-safe variant swaps + and / for - and _ so the string survives URL query placement.
btoa(String.fromCharCode(...new TextEncoder().encode(s))) and the exact inverse, with optional -_ alphabet substitution.
How to Use β Step by Step
- 1
Choose mode
Encode to get a transportable string; decode to recover the original. Invalid Base64 input is reported rather than silently mangled.
- 2
Pick the alphabet
Standard (+/) for data URIs and tokens; URL-safe (-_) when the value goes into a query string or path.
- 3
Copy the result
The output never contains line breaks, so it drops cleanly into any config or API field.
Frequently Asked Questions
No β it's an encoding, trivially reversible by anyone. Never use it to protect secrets; use our hash or password tools for security purposes.