Base64 Encode

Type or paste text to get its Base64 form.

Base64

How it works

Encoding takes the bytes of your text three at a time. Three bytes are 24 bits. Those are cut into four groups of 6 bits, and each group picks one character from the Base64 alphabet. If the text does not end on a multiple of three bytes, equals signs fill out the last group.

Because every three bytes become four characters, Base64 output is always about a third larger than the input.

Typical uses are embedding a small image in a web page as a data URL, sending a file inside JSON, and building the Authorization header for HTTP basic authentication, which is the user name, a colon and the password, encoded together.

This tool turns your text into UTF-8 bytes first, so characters outside basic English encode correctly.

Worked example

Hi is the bytes 72 and 105. In bits: 010010 000110 1001, padded to 100100. Those give S, G and k, plus one equals sign: SGk=

The Base64 alphabet

ValuesCharacters
0 to 25A to Z
26 to 51a to z
52 to 610 to 9
62+ (or - in URL safe Base64)
63/ (or _ in URL safe Base64)
padding=

Common questions

Does Base64 hide my data?

No. It is a format, not a lock. Anyone can reverse it in a second.

Why does the output end in equals signs?

They pad the last group to four characters when the input length is not a multiple of three bytes.

Related tools