Base64 Encoder and Decoder

Turn any text into Base64, or turn Base64 back into readable text. Paste your text, pick a direction, and the result appears as you type, ready to copy or download. Accented letters, symbols and emoji work, because the text is converted to UTF-8 bytes first. If a Base64 string is damaged, the tool tells you which character is wrong instead of returning garbage. Nothing you paste leaves your browser.

Inputs

Result

Base64
SGVsbG8sIHdvcmxkISBDYWbDqSDimJU=
UTF-8 bytes encoded
23
Base64 characters
32

How it is calculated

  1. Base64: start from the text to encode, then encode the text as UTF-8 bytes in standard Base64
  2. UTF-8 bytes encoded: start from the text to encode, then count the UTF-8 bytes
  3. Base64 characters: start from the base64, then count characters as you see them, including spaces

Resources for your next step

Helpful downloads

View all developer & web downloads
Store coming soon

We are preparing practical spreadsheets, planners, and guides. Explore the store page for what is next.

What Base64 does

Base64 writes any sequence of bytes using only 64 safe characters: the capital letters A to Z, the small letters a to z, the digits 0 to 9, and the plus sign and slash. Every 3 bytes of input become 4 Base64 characters, so encoded data is about a third longer than the original. When the input length is not a multiple of 3, one or two equals signs pad the end so the output length is a multiple of 4.

It is an encoding, not encryption. Anyone can decode Base64, so it hides nothing. Developers use it to carry bytes through places that only accept plain text, such as data URLs, email attachments, JSON fields, HTTP basic authentication headers and configuration files.

How text becomes bytes

Base64 works on bytes, so text is first turned into bytes using UTF-8, the encoding used by almost every web page and API. Plain English letters take one byte each, an accented letter such as é takes two, and most emoji take four. That is why the example, "Hello, world! Café ☕", has 20 characters but 23 UTF-8 bytes, and encodes to 32 Base64 characters.

When decoding, the bytes must form valid UTF-8 to be shown as text. If they do not, the Base64 probably holds an image, a compressed file or other binary data, and the tool says so rather than showing broken characters.

Standard and URL-safe Base64

The plus sign and slash have special meanings in web addresses and file names, so RFC 4648 also defines a URL-safe alphabet that uses a hyphen and an underscore in their place. JSON Web Tokens and many web APIs use this form, usually without the equals-sign padding. Turn on the URL-safe option to produce it.

The decoder accepts both alphabets, with or without padding, and ignores spaces and line breaks, so you can paste Base64 that was wrapped at 64 or 76 characters per line, as in email and PEM certificate files. It refuses a string that mixes the two alphabets, because that usually means two different values were pasted together.

Frequently asked questions

Is Base64 a way to encrypt or hide data?

No. Base64 only changes how bytes are written down. Anyone can decode it in a second, so never use it to protect passwords or private information.

Why does the encoded text end with = or ==?

Base64 turns each group of 3 bytes into 4 characters. If the last group has only 1 or 2 bytes, one or two equals signs fill the gap so the length stays a multiple of 4.

Why is my decoded result an error about UTF-8?

The Base64 decodes to bytes that are not text, such as an image or a zip file. This tool shows text only; the Base64 itself may be perfectly valid.

What is URL-safe Base64?

A variant from RFC 4648 that uses - and _ instead of + and /, so the result can go in a web address or file name without further encoding. The padding is usually left off.

Can I paste Base64 that is split across several lines?

Yes. Spaces, tabs and line breaks are ignored when decoding, which is how Base64 is usually wrapped in emails and certificate files.

How much longer does Base64 make my data?

About 33% longer: every 3 bytes become 4 characters, rounded up to a whole group of 4. A 30-byte input becomes 40 Base64 characters.

Sources

Text is processed in your browser and never sent anywhere. Base64 is not encryption; do not use it to protect sensitive data.

All developer & web tools