Base64 Encode & Decode

Encode text or files to Base64 and decode it back, privately.

What do you want to do?

Converted in your browser. Never uploaded, saved or put in the page link.

Examples

Result

20 characters

Encoded 13 bytes of UTF-8 text to 20 characters of Base64.

Output

SGVsbG8sIFdvcmxkIQ==
Input
13 bytes
Output
20 characters (+54%)

Base64 is an encoding, not encryption: anyone can decode it.

Fix the highlighted field to update the result.

How to use

  1. Choose Encode text, Decode Base64 or Encode a file.
  2. Type or paste into the box. The result updates as you type.
  3. For encoding, pick the alphabet (standard or URL-safe), padding and line breaks.
  4. Press Copy, or Use as input to reverse the conversion.

Files are read on your device and never uploaded, up to 2 MB. Decoded data that isn’t text, such as an image, is shown in hex with a Download button.

How Base64 works

Base64 (RFC 4648) writes any bytes using 64 safe characters: A–Z, a–z, 0–9, + and /.

  1. Text is first turned into bytes with UTF-8, so é takes 2 bytes and most emoji take 4.
  2. The bytes are split into groups of 3 bytes = 24 bits.
  3. Each group becomes 4 characters of 6 bits each.
  4. If the last group is short, “=” pads the output to a multiple of 4.

So the output is about 33% longer than the input: 100 bytes become 136 characters.

Example

“foo” is the bytes 66 6F 6F, or 01100110 01101111 01101111. Regrouped into 6-bit pieces, 011001 100110 111101 101111 are 25, 38, 61 and 47, which are the characters Zm9v.

Text Base64 URL-safe, no padding
f Zg== Zg
foobar Zm9vYmFy Zm9vYmFy
Hello, World! SGVsbG8sIFdvcmxkIQ== SGVsbG8sIFdvcmxkIQ
héllo 🌍 aMOpbGxvIPCfjI0= aMOpbGxvIPCfjI0
Padding, URL-safe Base64 and strict decoding
  • Padding: one “=” means the last group held 2 bytes; “==” means 1 byte. Some systems, such as JWTs, drop it.
  • URL-safe (base64url, RFC 4648 §5) uses “-” and “_” instead of “+” and “/”, which mean something in URLs.
  • Decoding accepts both alphabets, missing padding and line breaks (MIME wraps lines at 76 characters). Any other character is an error, with its position.
  • Not encryption: anyone can decode Base64. RFC 4648 says it offers no confidentiality.

Pasting Base64 into a link? Run it through the URL encoder too, or use the URL-safe alphabet.

Frequently asked questions

Is Base64 encryption?

No. Base64 only changes how bytes are written, and anyone can decode it instantly. RFC 4648 warns it gives no confidentiality, so never use it to hide secrets.

Why is Base64 longer than the original?

Every 3 bytes become 4 characters, so the output is about 33% larger, plus up to two “=” signs. Accented letters and emoji also take 2–4 bytes each in UTF-8.

What does the “=” at the end mean?

It is padding. One “=” means the last group held 2 bytes; “==” means it held 1 byte. This decoder also accepts Base64 with the padding left off.

What is URL-safe Base64?

It is the base64url alphabet from RFC 4648: “-” and “_” replace “+” and “/”, which have special meanings in URLs. The “=” padding is often dropped too.

Why does my decoded text look like gibberish?

The data is probably binary, such as an image or a zip file, rather than UTF-8 text. When that happens we show the bytes in hex and offer a download.

Is my text or file uploaded?

No. Encoding, decoding and file conversion all run in your browser. Nothing is sent to a server or added to the page link.