Base64 Encoder / Decoder
Encode text or files to Base64 — and decode back — without breaking on emoji.
Full UTF-8 support (the thing plain btoa() chokes on), a URL-safe alphabet option, file-to-Base64 encoding, and honest error messages when a string is not valid Base64. Everything happens locally in your browser.
16 characters in
Full UTF-8 support — accents, Chinese characters and emoji encode correctly (plain btoa() breaks on those). Everything runs locally in your browser.
Done-for-you
Need a tool like this on your own website?
Every calculator on this site was built by WebStore Pro — the same work I do for clients: fast, accurate, mobile-friendly tools and full stack websites from $80. If your site needs a custom calculator, converter or internal tool, I can build it for you.
Prefer email? neilsonsmarry@gmail.com · See my services — or explore the UUID Generator, Epoch Converter and Case Converter — plus 100+ more free tools on the tools hub.
The method
How Base64 encoding works
Three bytes in, four characters out. Base64 takes binary data three bytes at a time (24 bits), splits it into four 6-bit groups, and maps each group to a character from a 64-character alphabet (A–Z, a–z, 0–9, + and /). If the input does not divide evenly by 3, the final group is padded with '=' signs. Decoding runs the exact same mapping backwards.
Worked example
The text "Hi!" is the three bytes 72, 105, 33. Split into 6-bit groups and mapped through the alphabet, it becomes SGkh. And "Hello, World! 👋" encodes to SGVsbG8sIFdvcmxkISDwn5GL — the emoji works here because the text is converted to UTF-8 bytes first.
- Base64 is encoding, not encryption — never use it to protect secrets.
- Expect output ≈ 4/3 the input size; add line breaks every 76 chars for email (MIME).
- Use the URL-safe variant inside links, filenames and JWTs.
- A valid string's length is a multiple of 4, with '=' only at the very end.
- Data URIs (data:image/png;base64,…) embed small images directly in HTML and CSS.
FAQ
Base64 questions, answered
What is Base64 used for?+
Base64 turns binary data into plain ASCII text so it can travel through systems built for text: embedding images in HTML/CSS (data URIs), sending attachments in email (MIME), putting binary in JSON or XML, basic-auth headers, JWT tokens, and storing blobs in databases or config files. It is an encoding, not encryption — anyone can decode it.
Why does Base64 make data about 33% bigger?+
Base64 represents every 3 bytes of input as 4 characters from a 64-character alphabet. 4 ÷ 3 = 1.333, so the output is roughly 33% larger than the input, plus occasional '=' padding to round the length up to a multiple of 4. That overhead is the price of text-safe transport.
Why do emoji and accented characters break some Base64 tools?+
JavaScript's built-in btoa() only accepts Latin-1 characters, so it throws on emoji, accents beyond Latin-1, Chinese or Arabic text. This tool first converts your text to UTF-8 bytes (TextEncoder) and only then to Base64 — and reverses the process with TextDecoder — so any Unicode text round-trips exactly.
What is URL-safe Base64?+
Standard Base64 uses '+' and '/', which mean other things in URLs, and '=' padding. The URL-safe variant (RFC 4648 §5) swaps '+' for '-' and '/' for '_', and usually drops the padding. Use it for tokens in links, filenames and JWTs. Toggle it above the tool — decoding accepts it too.
Why won't my Base64 decode?+
Usually one of three things: characters outside the Base64 alphabet got mixed in (spaces are forgiven here, other symbols are not), the string was truncated when copied, or it is URL-safe Base64 being decoded as standard. This tool validates the input and tells you plainly instead of printing garbage.
Is it safe to paste secrets here?+
The conversion runs 100% in your browser — nothing is uploaded or stored. That said, remember Base64 is not encryption: never treat a Base64 string as protected, and never use it to 'hide' passwords or keys in code or URLs.
