Base64 encoder and decoder

Encode text to base64 or decode it back, with UTF-8 handled correctly and a URL-safe variant for tokens and query strings.

Direction
Base64base64
The result appears here

Questions

Why does btoa break on emoji and accented characters?+

btoa only accepts characters in the Latin-1 range. This tool encodes the text to UTF-8 bytes first and base64s those bytes, so emoji, accented characters and any other Unicode round trip correctly.

What is the URL-safe variant?+

Standard base64 uses + and /, which have meaning inside URLs. The URL-safe alphabet replaces them with - and _ and drops the = padding. It is what JWTs and most token formats use.

Can I decode a JWT with this?+

You can decode each segment by hand, since a JWT is three URL-safe base64 strings separated by dots. A dedicated JWT decoder that splits and pretty prints the payload is on the way.

Is base64 encryption?+

No, and treating it as such is how secrets end up in public. Base64 is a way to carry bytes through a text channel; anyone can decode it with no key. It hides nothing, it only survives transport.

Why is the output longer than the input?+

Because three bytes become four characters, so anything encoded grows by about a third, plus padding. That is the cost of putting a data URI inline, and the reason a base64 image in your CSS is bigger than the file it came from.

Related tools

The tools are free. So is most of the library.

1935 blocks and 989 pieces for shadcn/ui and Tailwind, built on the same tokens these tools write. Install one with a command and the code is yours.

No signup for the tools. MIT for free blocks, commercial licence for Pro.

Markdown version