By · Updated

Base64 Encoder & Decoder

Decode a JWT Payload or Make URL-Safe Base64 With Full UTF-8 Support

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Base64 Encoder / Decoder works

This Base64 encoder also decodes, and handles Unicode text. Paste text to turn it into Base64, or paste Base64 to get the text back. Unicode, emoji and accented characters all survive the round trip, and the decoder accepts the URL-safe alphabet and unpadded input, so a JWT payload pasted straight from a browser console decodes cleanly.

Base64 encoder: getting a good result

Base64 takes arbitrary bytes and rewrites them using 64 characters that survive being pasted into places that were only ever designed to carry plain text — email headers, JSON strings, XML attributes, a URL. That is the whole job. It is a transport format, and understanding what it does not do is more useful than understanding what it does.

Base64 is not encryption. This is the one that costs people real money. Anything encoded here can be decoded by anyone, instantly, with no key, using this page. A password, an API token or a customer record encoded into Base64 is exactly as exposed as it was before — it is simply less obviously readable at a glance, which is worse than plaintext because it looks like it has been protected. The Authorization: Basic header is Base64 for framing reasons only; it is safe over HTTPS and completely open over HTTP. If you need secrecy you need encryption, and Base64 is the thing you often apply after encrypting, so the ciphertext can be pasted somewhere.

It always makes things bigger, by about a third. Three bytes of input become four characters of output, because each output character carries six bits rather than eight. That is a fixed 4:3 ratio, so 3 MB of data becomes 4 MB of Base64, plus padding. This is why inlining images as data: URIs is a trade rather than a win — you save an HTTP request and pay 33% more bytes on the wire, before compression claws some of it back. The trailing = characters are padding that rounds the output to a multiple of four; one = means the input ended one byte short of a group of three, two = means two bytes short.

There is more than one alphabet. Standard Base64 uses + and / for its last two characters, and both mean something else inside a URL — + is read as a space in a query string and / splits the path. The URL-safe variant substitutes - and _, and usually drops the padding as well, because = also needs escaping. JWTs use exactly this variant, which is why a token pasted into a standard decoder often fails on the last few characters. The decoder above accepts either alphabet and re-adds missing padding, so you do not have to work out which one you have.

Unicode needs a step that older tools skip. The browser's own btoa only accepts characters below 256 and throws on anything else, which is why so many decoders mangle accented text and emoji. This tool converts text to UTF-8 bytes first and decodes them back the same way, so café, Москва and 🙂 all round-trip exactly.

FAQ

Is Base64 secure — can I use it to hide a password?

No. Base64 is an encoding, not encryption, and decoding it needs no key, no secret and no special software. Treat anything you encode as fully readable by anyone who sees it. Use real encryption if the contents need to stay private, and encode the ciphertext afterwards if it must travel as text.

Why does my decoded text come out as garbage characters?

Almost always because the original bytes were not UTF-8 text — an image, a compressed file or text in a legacy encoding such as Windows-1252. This tool decodes as UTF-8 and reports binary data as such rather than silently producing question marks, so a garbled result means the source was never plain text.

What are the equals signs at the end for?

They are padding. Base64 works in groups of three input bytes to four output characters, and when the input does not divide evenly the output is padded to a multiple of four. One = means one byte was missing from the final group, two = means two were. Many systems omit padding entirely, and this decoder restores it for you.

Can I decode a JWT here?

Paste the whole token. A JWT is three URL-safe Base64 sections joined by dots, and the decoder shows the header and payload claims as formatted JSON. It handles the URL-safe alphabet and the missing padding automatically. It does not verify the signature, so never trust a token's contents on the strength of a decode alone.

See also: all Data & Encoding tools, Dev Utilities, Formatters & Validators, Security & Identifiers, SEO, Accessibility, AI.

Related tools