DevKit Tools

Base64 Encoder and Decoder

Encode text to Base64 and decode it back, with correct Unicode handling and a URL-safe variant.

Data/Base64 Encode / Decode

Convert text to Base64 and back. Handles Unicode correctly (not just ASCII).

Result

✓ Ready to encode.

SGVsbG8sIERldktpdCEgQ2Fmw6kgw5E=

About this tool

Base64 turns binary data into ASCII so it can travel through text-only channels. The classic bug is that the browser's btoa only handles Latin-1, so any emoji or non-Latin character throws an error. This tool encodes through UTF-8 bytes first, which handles every character correctly.

The URL-safe variant swaps + and / for - and _ and drops the padding, which is what JWTs and query parameters use.

Base64 is not compression. It grows the data by roughly a third, because it packs every three bytes into four printable characters. That is the price of making binary safe to paste as text, and it is why you encode a small key or icon this way, not a large file.

A few details

  • Decoding is strict about the alphabet but forgiving about padding, so a string copied without its trailing equals signs still decodes.
  • The data URI you sometimes see, like data:image/png;base64,..., is just a MIME type glued to a Base64 payload. Encode the bytes here and prepend the prefix to build one by hand.
  • A newline pasted into the middle of an encoded string is a common cause of a decode failure. Strip line breaks before decoding if the source wrapped the text.

How it works

  1. 1Choose encode or decode.
  2. 2Paste your text.
  3. 3Turn on URL-safe output if it will go in a URL or a token.
  4. 4Copy the result.

Frequently asked

Why does encoding emoji fail elsewhere?

Plain btoa only accepts Latin-1 characters. Encoding the string to UTF-8 bytes first is what makes emoji and non-Latin scripts work, which is what this tool does.

Is Base64 encryption?

No. It is encoding, fully reversible by anyone. Never use it to protect anything.

What is URL-safe Base64?

A variant using - and _ instead of + and /, with padding removed, so the string survives being placed in a URL.

Why is my Base64 longer than the original?

Because Base64 always expands data by about a third. Four output characters carry three input bytes, so the growth is inherent, not a fault of the encoder.

What are the trailing equals signs for?

They are padding that rounds the output to a multiple of four characters. The URL-safe option removes them, since a decoder can infer the length without them.

Try next

More Text & Data tools