Skip to content
TOOL FOR EVERYTHING
Open menu

Base64 encoder and decoder

This Base64 encoder turns any text, including emoji and accented letters, into Base64, and decodes Base64 back into readable text.

Last updated

Your text stays in your browser. Nothing you paste is uploaded or stored.

How to use the Base64 encoder

  1. Type or paste text into the box to encode it, or paste a Base64 string to decode it.
  2. Press Encode to turn text into Base64, or Decode to turn Base64 back into text.
  3. If the input isn't valid Base64, you see a clear error instead of garbled output.
  4. Press Copy to put the result on your clipboard.

How the Base64 encoder works

Base64 represents any data using only 64 safe characters: A to Z, a to z, 0 to 9, plus and slash, with = used as padding. It is used wherever binary data has to pass through systems built for text, such as email attachments, data URLs and web tokens.

Base64 is an encoding, not encryption: anyone can decode it, so never use it to hide passwords or secrets. The tool first turns your text into UTF-8 bytes, which is why emoji and non-English letters work correctly, and it runs entirely in your browser.

Formula

Encoding: text → UTF-8 bytes → groups of 3 bytes (24 bits) → four 6-bit numbers → four characters from the Base64 alphabet. A final group of 1 or 2 bytes is padded with = signs.

Decoding reverses the steps. Spaces and line breaks are ignored, the URL-safe characters - and _ are accepted, and missing padding is added automatically.

Example

The word Man is the bytes 77, 97 and 110. As 24 bits, these split into the 6-bit numbers 19, 22, 5 and 46, which map to T, W, F and u, so Man encodes to TWFu.

The text héllo is 6 bytes in UTF-8, because é takes two bytes, and it encodes to aMOpbGxv. Every 3 bytes of input become 4 characters, which makes Base64 about 33% larger than the original.

Tips and common mistakes

Never use Base64 to hide secrets

Decoding takes a second with any tool, including this one. Use real encryption or a password manager for sensitive data.

Expect output a third bigger

Embedding a large image as a Base64 data URL makes pages heavier. Compress the image or convert it to WebP first.

Reading web tokens

A JSON web token is three Base64 parts separated by dots. Decode the middle part, then paste the result into the JSON formatter to read it.

Binary data shows an error

If a Base64 string holds an image or a file rather than text, it can't be shown as text, and the tool tells you so instead of printing gibberish.

Frequently asked questions

Is Base64 a form of encryption?

No. It is a reversible encoding that anyone can decode. It keeps data intact in transit but does not keep it secret.

Why does Base64 sometimes end with = signs?

Base64 works in groups of 3 bytes. When the data doesn't divide evenly, one or two = signs pad the last group.

What is URL-safe Base64?

A variant that uses - and _ instead of + and / so the text can sit in a web address. This decoder accepts both.

Is my text sent anywhere?

No. Encoding and decoding happen in your browser, so your data stays on your device.

Can I decode a Base64 image?

This tool decodes text only. An image's Base64 data can't be shown as text, so you'll see a message saying it is binary data.