* Your content are not transferred to the server. All calculations are performed directly in the browser
Plain Text
Encoded Text
What is Base64 Encoding?

Base64 encoding is a way to convert data (typically binary) into the ASCII character set. It is important to mention here that Base64 is not an encryption or compression technique, although it can sometimes be confused as encryption due to the way it seems to obscure data. In fact, size of a Base64 encoded piece of information is 1.3333 times the actual size of your original data.

Base64 is the most widely used base encoding technique with Base16 and Base32 being the other two commonly used encoding schemes.

Base64 encoding is one of the most common ways of converting binary data into plain ASCII text. It is a very useful format for communicating between one or more systems that cannot easily handle binary data, like images in HTML markup or web requests

How Does Base64 Work?

Converting data to base64 is a multistep process. Here is how it works for strings of text:

  1. Calculate the 8 bit binary version of the input text
  2. Re-group the 8 bit version of the data into multiple chunks of 6 bits
  3. Find the decimal version of each of the 6 bit binary chunk
  4. Find the Base64 symbol for each of the decimal values via a Base64 lookup table
Base64 Encoding Table
ValueCharValueChar
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/
Why use Base64 Encoding?

Sending information in binary format can sometimes be risky since not all applications or network systems can handle raw binary. On the other hand, the ASCII character set is widely known and very simple to handle for most systems.

For instance email servers expect textual data, so ASCII is typically used. Therefore, if you want to send images or any other binary file to an email server you first need to encode it in text-based format, preferably ASCII. This is where Base64 encoding comes extremely handy in converting binary data to the correct formats.

Exploring Common Use Cases for Base64

You can also use Base64 to represent binary data in a way that is compatible with HTML, JavaScript, and CSS. For example, you can embed an image inline in a CSS or JavaScript file using Base64.

It is possible to use Base64 to convert input, like form data or JSON, to a string with a reduced character set that is URL-safe. However, due to how certain servers may interpret plus (+) and forward-slash (/) characters, it is recommended to use encodeURIComponent instead.

Understanding the Limitations of Base64

Base64 is in no way meant to be a secure encryption method.

Base64 is also not a compression method. Encoding a string to Base64 typically results in 33% longer output.