base64 *

The goal is to represent a byte sequence with printable ascii characters, without too much overhead.

We take the bytes 3 by 3, and instead of interpreting each chunk as 3 * 256 (8bit) possible values, we interpret them as 4 * 64 (6bit) possible values.

For the regular base64 encoding, those 64 possible values are taken from this "alphabet":
ABCDEFGHIJKLMNOPQRSTUVWXZYabcdefghijklmnopqrstuvwxyz0123456789+/

If the byte sequence length is not divisible by 3, the last character missing bits are set to zero, and depending on the number of missing bits (2 or 4), one or two padding characters = are added to the end.

The characters + and / in the regular alphabet are not safe to use for urls. Therefore, there's an official variation called base64url that uses - and _ instead. It also makes the padding characters optional.

0x 47494638396101000100800000ffffff00000021f90401000000002c00000000010001000002024401003b R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==
Variant
Padding
transparent_pixel.gif:
43b
compressed:
48b
encoded:
60b
compressed:
50b
Paste, drag & drop,
or .