Base64 Algorithm

Base64 is a highly effective algorithm for encoding byte data into ASCII string format, known as binary-to-text conversion. What makes this algorithm unique is its ability to decode the text back to its original byte code without any data loss. This makes it a widely popular choice in web technologies, especially for converting binary files into text for emails and converting graphic elements encoded in HTML and CSS. Its versatility and efficiency make it an essential tool for any web developer or tech enthusiast.

The Base64 algorithm is a method of encoding data that involves grouping bytes in sets of three (each containing 8 bits, for a total of 24 bits) and then converting each set into a group of four 6-bit values. These 6-bit values represent an index between 0 and 63 for 64 possible indexes, so the algorithm is called Base64. An ASCII character set is used to convert this encoded data into a human-readable format; by the RFC 4648 standard, this character set assigns specific characters to the 64 possible 6-bit values, allowing the encoded data to be translated into its original form.

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/

If there is insufficient data to form a group of 3 bits, the missing bits are filled with the symbol "=."

Table of Base64 (RFC 4648)

IndexBinaryChar IndexBinaryChar IndexBinaryChar IndexBinaryChar
0000000A16010000Q32100000g48110000w
1000001B17010001R33100001h49110001x
2000010C18010010S34100010i50110010y
3000011D19010011T35100011j51110011z
4000100E20010100U36100100k521101000
5000101F21010101V37100101l531101011
6000110G22010110W38100110m541101102
7000111H23010111X39100111n551101113
8001000I24011000Y40101000o561110004
9001001J25011001Z41101001p571110015
10001010K26011010a42101010q581110106
11001011L27011011b43101011r591110117
12001100M28011100c44101100s601111008
13001101N29011101d45101101t611111019
14001110O30011110e46101110u62111110+
15001111P31011111f47101111v63111111/
Padding=

Example with the word "HELLO"

HELLO 
7269767679
010010000100010101001100010011000100111100------
184211219460Padding
SEVMTE8=

HELLO -> SEVMTE8=