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