Base64 turns arbitrary bytes into a text string using 64 printable characters, which lets binary data travel safely through systems that only handle text — email, JSON, data URIs, and JWTs. This tool encodes UTF-8 text or hex bytes into Base64 (or URL-safe Base64url) and decodes either variant back, all in your browser.
How it works
Base64 packs every 3 input bytes (24 bits) into 4 output characters (6 bits each):
- Encoding text first converts the string to UTF-8 bytes with
TextEncoder, so multi-byte characters such as emoji are preserved. - Each group of 3 bytes maps to 4 characters from the alphabet
A-Z a-z 0-9 + /; leftover bytes are padded with=. - Base64url then rewrites
+to-,/to_, and strips the=padding so the value is safe inside URLs. - Decoding reverses the process, normalising url-safe characters and restoring padding before rebuilding the bytes, then attempting a strict UTF-8 decode.
If a decode produces bytes that are not valid UTF-8, the tool shows hex rather than mojibake.
Tips and examples
Encoding the text Hi gives SGk=. Encoding the hex bytes 48 69 (which spell “Hi” in ASCII) gives the same SGk=, which is handy for inspecting binary protocol payloads.
When you paste a value shaped like xxxxx.yyyyy.zzzzz, the tool recognises a JWT and reminds you to decode the header and payload segments individually. PEM blocks and data: URIs are flagged too, so you know where the actual Base64 body lives.