Base64 Encode and Decode

Turn any text into Base64, or decode Base64 back into readable text. Accents, other alphabets and emoji are handled correctly, and it all runs in your browser.

Your results

–

How to use the Base64 encoder and decoder

  1. Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
  2. Type or paste your text or Base64 into the box. The result updates as you type.
  3. When encoding, pick the alphabet: standard, or URL-safe for web addresses and tokens. Tick the MIME box to break the output into 76-character lines for email.
  4. Use the Copy button to copy the full result.

Decoding accepts both alphabets, ignores spaces and line breaks, and adds missing padding for you. Nothing you type leaves your browser.

How Base64 encoding works

Base64 turns bytes into 64 safe, printable characters. It takes the data three bytes (24 bits) at a time and splits them into four groups of six bits. Each six-bit number, from 0 to 63, picks one character:

0–25 → A–Z 26–51 → a–z 52–61 → 0–9 62 → + 63 → / Output length = 4 × ⌈bytes ÷ 3⌉ characters (with = padding)

Text has to become bytes first. This tool uses UTF-8, the encoding of almost every web page, so plain English letters take one byte each and characters like é, €, ü or emoji take two to four. If the last group has only one or two bytes, it's padded with zero bits and the output ends with == or =.

Worked example

The default text is Café:

  • In UTF-8, C, a and f are the bytes 43, 61 and 66 (in hex), and é is two bytes, C3 A9. That makes 5 bytes.
  • First three bytes in binary: 01000011 01100001 01100110. Split into sixes: 010000 110110 000101 100110, which is 16, 54, 5 and 38, or Q2Fm.
  • The last two bytes, 11000011 10101001, get two zero bits added: 110000 111010 100100, which is 48, 58 and 36, or w6k. One = marks the missing byte.
  • Result: Q2Fmw6k=, 8 characters from 5 bytes.

Decoding reverses the steps. The default Base64, SGVsbG8sIHdvcmxkIQ==, decodes to Hello, world!

Standard, URL-safe and MIME Base64

Variant Characters 62 and 63 Padding Used in
Standard (RFC 4648 §4) + and / = at the end Data URIs, HTTP Basic auth, most APIs
URL-safe (RFC 4648 §5) - and _ Usually left off JSON Web Tokens, URL parameters, file names
MIME (RFC 2045) + and / = at the end Email attachments, with a line break every 76 characters

The + and / of standard Base64 have special meanings in URLs, so the URL-safe alphabet swaps them out. The details are in RFC 4648.

Common decoding errors

If you see an error, look for a character outside the alphabet, such as a stray quote or a percent code left over from a URL. The = sign can only appear at the end. A length that leaves one leftover character usually means the text was cut off while copying. If the bytes decode fine but aren't valid UTF-8, the data is probably an image, a compressed file or encrypted data, and the tool shows it as hex instead.

Frequently asked questions

Is Base64 a form of encryption?

No. Base64 is an encoding that anyone can reverse instantly, with no key. It makes binary data safe to send through systems built for text, but it hides nothing. Never rely on it to protect passwords or private data.

Why is Base64 output bigger than the input?

Every 3 bytes become 4 characters, so the output is about 33% larger, plus up to two padding characters. Line breaks in MIME format add a little more. A 30 KB image becomes about 40 KB of Base64 text.

Why does decoded text show strange characters like é?

That happens when UTF-8 bytes are read as an older encoding such as Latin-1, so é (bytes C3 A9) turns into é. This tool always encodes and decodes as UTF-8, which matches modern web pages and APIs. If the source used another encoding, the text needs converting first.

What do the = signs at the end mean?

They are padding. Base64 works in blocks of 4 characters, and = fills the gap when the last block holds only one or two bytes. One = means 2 bytes in the last block and == means 1. URL-safe Base64 often leaves them off, and this decoder accepts it either way.

Related calculators

  • URL Encode and Decode — Percent-encode text or whole URLs, decode them back, and see any URL split into its parts and query parameters.
  • Password Generator — Strong random passwords or word passphrases made in your browser, with the entropy and a strength rating for each.
  • Hex Calculator — Hexadecimal arithmetic, hex to decimal and binary conversion, and two's complement for 8, 16, 32 and 64-bit numbers.
  • Binary Calculator — Add, subtract, multiply and divide binary numbers, run AND, OR, XOR and NOT, and convert binary, octal, decimal and hex.

Results are calculated in your browser. Double-check anything important before you rely on it. See our disclaimer.