Base64 Encode and Decode

  • Tested against the RFC 4648 test vectors and 900 cases checked with Python's base64 module
  • Checked by Wayne Bickerton
  • Sources: RFC 4648, RFC 3629
  • Updated November 11, 2026

Base64 writes any data, from a word to an image, with 64 safe characters (A–Z, a–z, 0–9, + and /), 4 characters for every 3 bytes, so it can travel through email, web addresses and code that only handle text. It is not encryption: anyone can decode it. Paste text to turn it into Base64, or switch and paste Base64 to read what it says.

Converted on your device. What you type goes into the page’s link (and your browser history), so don’t paste passwords or keys.

In Base64
SGVsbG8sIHdvcmxkIQ== Standard

“Hello, world!” is 13 bytes, so it becomes 20 Base64 characters, ending in 2 padding signs.

Bytes in 13
Base64 characters 20
Padding 2 “==”

How Base64 encoding works

A computer stores text as bytes: “H” is 72, “e” is 101 (with UTF-8 for accents and emoji). Base64 takes 3 bytes at a time, 24 bits, and cuts them into 4 groups of 6 bits. Each 6-bit group is a number from 0 to 63, and the alphabet below turns it into one character. So Base64 is always about a third longer than the data.

Every 3 bytes (24 bits) → 4 groups of 6 bits → 4 characters of the alphabet

Here it is with your numbers:

  1. The first 3 bytes are “Hel”: 72, 101, 108. In binary: 01001000 01100101 01101100.
  2. Join the 24 bits and cut them into 4 groups of 6: 010010 000110 010101 101100.
  3. As numbers those are 18, 6, 21, 44, which the alphabet table turns into SGVs.

It means your text starts SGVs in Base64, and the whole of it is 20 characters long.

If the data doesn’t divide into groups of 3, the last group is filled with zero bits and finished with one or two = signs, so the Base64 length is a multiple of 4.

Source RFC 4648 · The Base16, Base32, and Base64 Data Encodings ↗RFC 3629 · UTF-8, a transformation format of ISO 10646 ↗

The Base64 alphabet

ValueCharacterValueCharacter
0A32g
1B33h
2C34i
3D35j
4E36k
5F37l
6G38m
7H39n
8I40o
9J41p
10K42q
11L43r
12M44s
13N45t
14O46u
15P47v
16Q48w
17R49x
18S50y
19T51z
20U520
21V531
22W542
23X553
24Y564
25Z575
26a586
27b597
28c608
29d619
30e62+
31f63/

The URL-safe alphabet is the same except that 62 is - and 63 is _, because + and / mean something else in web addresses and file names. The padding sign is =.

Base64 is not encryption

Base64 makes data look scrambled, but there is no key: anyone can decode it in a second, here or with one line of code. The standard itself says it gives no real confidentiality, and that people have leaked passwords by sharing Base64 that “looked safe”. To keep something secret, encrypt it.

FAQs

What is a Base64 decode?

Decoding turns Base64 text back into the bytes it was made from. Every 4 Base64 characters give back 3 bytes; if those bytes are text, you can read it, and if they are an image or a file, they are binary data.

Source RFC 4648 · The Base16, Base32, and Base64 Data Encodings ↗

What does Base64 code look like?

A run of letters, digits, + and /, often ending in one or two = signs, like SGVsbG8sIHdvcmxkIQ== (that is “Hello, world!”). Its length is always a multiple of 4 when it is padded.

What does == mean in Base64?

It is padding. Base64 works in groups of 3 bytes; when the last group has only 1 byte, two = signs fill it out to 4 characters, and when it has 2 bytes, one = does.

How can I tell if something is Base64 encoded?

Look for only A–Z, a–z, 0–9, + and / (or - and _), a length that is a multiple of 4, and = only at the end. Text that passes can still be plain words that happen to fit, so try decoding it: real Base64 usually gives readable text or a known file.

Is Base64 encoding safe?

Base64 hides nothing. The standard itself warns that it hides information such as passwords from a quick look but gives no real secrecy: anyone can decode it. Use encryption to keep data private.

What is Base64 used for?

For sending binary data through systems built for text: email attachments, images written into web pages and style sheets, and data in web addresses and tokens (with the URL-safe alphabet).

Sources

Related calculators