Base64 Encoder & Decoder
Encode text to Base64 or decode it back, with full Unicode support.
22 characters in, 36 out.
About this tool
Convert text to Base64 and back. Unicode is handled properly, so emoji and non-Latin scripts survive the round trip instead of turning into question marks. A URL-safe variant is available for tokens and query strings.
How to use it
- Choose Encode or Decode.
- Paste your text or Base64 string.
- Toggle URL-safe if you need the -/_ alphabet without padding.
Why other tools break your emoji
The browser's built-in btoa() function only accepts characters in the range 0–255. Hand it an emoji, a Cyrillic character or a German umlaut and it throws an InvalidCharacterError. Many quick online encoders wrap btoa() directly, which is why they fail or silently corrupt non-English text.
The fix is to convert to UTF-8 bytes first:
const bytes = new TextEncoder().encode(text);
Now every character — regardless of script — is a sequence of bytes in the 0–255 range, which btoa() can handle. Decoding reverses it with TextDecoder.
This tool does that, so Grüße, привет and 👋 all survive the round trip intact.
Standard vs URL-safe, and the padding question
Standard Base64 uses + and / as its last two characters. Both are meaningful inside a URL — + historically means a space in query strings, and / is a path separator — so a Base64 string dropped into a URL can be mangled.
URL-safe Base64 swaps them for - and _, and usually drops the = padding. This is the variant JWTs use, which is why a token contains no plus signs or slashes.
Padding is optional to decode. The = characters pad the output to a multiple of four so a decoder knows where the data ends. A correct decoder can work it out from the length alone, which is why this tool restores missing padding automatically when you paste an unpadded string.
The 33% overhead is inherent. Base64 represents 3 bytes as 4 characters. That is the price of surviving text-only channels, and no variant avoids it.
Frequently asked questions
- What is URL-safe Base64?
- It replaces + with - and / with _, and usually drops the = padding, so the result can sit in a URL or filename without escaping. JWTs use this variant.
- Why do other tools break my emoji?
- Naive implementations call btoa() directly, which only accepts Latin-1. This tool encodes to UTF-8 bytes first, so any character round-trips correctly.
- Does my text leave the browser?
- No. Encoding uses the browser's built-in btoa and TextEncoder, with no network request at all. The page works offline once loaded.