Base64 encoding is a method for converting binary data such as images, files, or any non-text data into an ASCII string format using a set of 64 characters: A-Z, a-z, 0-9, +, and /.
It works by taking input bytes, grouping them into sets of three, then dividing those 24 bits into four groups of six bits. Each 6-bit group is mapped to a character from the Base64 alphabet. Padding with = is used if the input data is not a multiple of three bytes.
Decoding is the reverse process: the encoded Base64 string is processed in groups of four characters, each mapped back into a 6-bit value and then combined to reconstruct the original bytes.
Example Conversion:
The text Hello encodes to SGVsbG8= in Base64. Decoding SGVsbG8= returns Hello.