Base64
Encode and decode Base64 strings
What is Base64 and when is it used?
Base64 represents arbitrary bytes using only 64 printable ASCII characters (A–Z, a–z, 0–9, `+`, `/`). It's used to embed binary data in places that expect text — email attachments (MIME), data URIs (`data:image/png;base64,...`), JWT tokens, basic-auth headers, and configuration files.
Encoding adds about 33% overhead — three input bytes become four output characters. The browser's native `btoa`/`atob` only handles Latin-1 strings, so this tool wraps them with proper UTF-8 conversion to avoid 'character out of range' errors when encoding emoji or non-Latin text.
Examples
| Input | Result |
|---|---|
| Hello, World! | SGVsbG8sIFdvcmxkIQ== |
| Café ☕ | Q2Fmw6kg4piV |
Frequently asked questions
Why does the browser's native btoa fail on emoji?
`btoa` only accepts Latin-1 (single-byte) characters. Multi-byte UTF-8 sequences trigger 'InvalidCharacterError'. This tool encodes to UTF-8 bytes first, then to Base64 — handles any Unicode.
What's URL-safe Base64?
A variant that replaces `+` with `-` and `/` with `_`, so the encoded string is safe in URLs and filenames without further escaping.
Why does the decoded output look garbled?
Either the Base64 was corrupted, was URL-safe (use the URL-safe option), or wasn't text in the first place — Base64 routinely encodes binary data that doesn't decode to readable text.
Is Base64 secure?
No — Base64 is encoding, not encryption. Anyone can decode it. Use it for transport, not for hiding secrets.
Does the tool log anything?
No. Encoding and decoding happen in your browser; nothing is sent to a server.
