BASE64encode and BASE64decode

BASE64 is an encoding/decoding algorithm for handling binary data. For example, if binary data is to be sent via mail, http or other protocols that only support text (in whole or in part), it is therefore necessary to have the binary data translated into text.

BASE64 can thus also be used to embed binary data in HTML, CSS and JavaScript files that are only text-based.

The BASE64 algorithm was defined in 2006 with RFC 4648. There are also BASE32 and BASE16 variants - but today, only BASE64 is actually used.

The algorithm is based on the fact that there are only 64 permitted characters: [A-Z], [a-z], [0-9] and the special characters '+', '/' and '='.

The algorithm works by translating the binary byte data into bits. The row of bits is then read 6 bits at a time which is then translated into one of the allowed characters. For example, the word "Man" consists of the ASCII characters 77, 97 and 110. Translated into bits, it is "01001101 01100001 01101110".

If you thus read this line of bits, in chunks of six bits at a time, you get the following: "010011 010110 000101 101110". The decimal values ​​are 19, 22, 5 and 46. Using the BASE64 character table, this can then be written as the characters "TWFu". Thus "Man" is BASE64 encoded to "TWFu".

If you want to read more about the BASE64 protocol, Wikipedia has an excellent page about it.

Try out these, if you would like to give it a go, and see how it works:

BASE64 encode 'Man' BASE64 encode random lorem-ipsum! BASE64 decode the encoded lorem ipsum BASE64 decode 'TWFu'


These tools are still in active development. If you have any kind of feedback, please let me know. Send me an e-mail on iamrootdottech(a)