Base64 encoding works by dividing every 3 bytes (24 bits) of binary data into 4 groups of 6 bits each. Each group of 6 bits is then represented by a character from the Base64 character set.
The character set includes A-Z, a-z, 0-9, and two additional characters, typically '+' and '/' (though these can vary). If the binary data length is not a multiple of 3, padding with '=' characters is added to make the encoded output length a multiple of 4.