Base64

Base64 is an algorithm that converts binary to text and vise versa used for sending binary data over a text-based protocol such as HTTP. It ensures that text does not gets corrupted during the transfer.

Base64 index table


base64.png 50.1 KB


Example:


Consider the following example using only ASCII text:
Code Beautify has a set of online tools that helps you to decode and encode data in Base64 format.

If we encode the above quote we will get the following result:

Q29kZSBCZWF1dGlmeSBoYXMgYSBzZXQgb2Ygb25saW5lIHRvb2xzIHRoYXQgaGVscHMgeW91IHRvIGRlY29kZSBhbmQgZW5jb2RlIGRhdGEgaW4gQmFzZTY0IGZvcm1hdC4=
 
Let's see how text is actually encoded. For example, let's take the first word Code and convert each letter in the corresponding byte.
C = 67
o = 111
d = 100
e = 101

Next convert each decimal into their binary representation:
67 = 01000011
111 = 01101111
100 = 01100100
101 = 01100101

Next join all binary octets into one
01000011011011110110010001100101

And finally split it in a group of 6 bits
010000 110110 111101 100100 011001 01

Now if we look up each group in the index table we will get the following result:
010000 = Q
110110 = 2
111101 = 9
100100 = k
011001 = Z
01 = part of the next group of 6 bits since we are only converting the word Code

As you see, we got Q29kZ which is the same first 5 characters in the above example. Feel free to play with both base64 decoder / encoder tools by that we have on our site.