Base64 Decode Online

Base64 Decode Online

Base64 Decoder is a simple and easy-to-use online tool to decode any Base64 encoded data back to binary data.
Check out the Base 64 encoder online tool at Base64 Encode Online

What is Base64 encoding and decoding?

Base64 encoding is an algorithm to convert binary data into an ASCII character set. The encoding is required to transmit binary data safely through communication media/protocols that are designed to handle only textual data.
For example, email servers were traditionally designed to handle textual data from the ASCII character set. Therefore, if you want to send images or any other file via email, you first need to encode the image or file to Base64 encoded format and then send the encoded data to the email server.

The encoded data can be converted back to the original image or file at the receiver’s end using Base64 decoding. Base64 decoding is the inverse process of encoding. It converts the Base64 encoded data back to binary data.

Note that, Base64 should not be confused with encryption or compression techniques. It is just an encoding algorithm. You should not use Base64 encoding as a means to hide sensitive data.

We also have a tool to encode any binary data to Base64 encoded format. You can check it out at Base64 Encode Online.

Base64 Encoding and Decoding process

The Base64 encoding process receives input in the form of 8-bit bytes. It processes the input from left to right and organizes the input into 24-bit groups by concatenating three 8-bit bytes. These 24-bit groups are then treated as 4 concatenated 6-bit groups. Finally, each 6-bit group is converted to a single character in the Base64 alphabet by consulting the above Base64 alphabet table.

When the input has fewer than 24 bits at the end, zero bits are added (on the right) to form an integral number of 6-bit groups. Then, one or two pad (=) characters are output depending on the following cases -
  • Input has 8 bits remaining at the end: Four zero bits are added to form two 6-bit groups. Each 6-bit group is converted to the resulting Base64 encoded character using the Base64 index table. After that two pad (=) characters are appended to the output.
  • Input has 16 bits remaining at the end: Two zero bits are added to form three 6-bit groups. Each of the three 6-bit groups is converted to the corresponding Base64 alphabet. Finally, a single pad (=) character is appended to the output.
The decoding process does the opposite of the above encoding process. Let’s look at an example to understand how Base64 encoding works:
Input: a@bc
Binary Representation of input (8-bit bytes):
01100001 01000000 01100010 01100011
Step 1: Organize the input into 24-bit groups (having four 6-bit groups each). Pad with zero bits at the end to form an integral no of 6-bit groups.
011000 010100 000001 100010 011000 110000 # (padded with four zeros at the end)
Step 2: Convert the 6-bit sequences to the Base64 alphabets by indexing them into the Base64 index table. Add a pad character if zero bits are added at the end of the input.

The above 6-bit groups equate to the following indexes:
24 20 1 34 24 48
Indexing into the Base64 alphabet table gives the following output:
YUBiYw==  # (padded with two `=` characters)

Related Online Tools