HomeToolsAbout

Base64 and 62

What is it

Base 64 is widely used to encode binary data, because 6 bits exactly fit one character, but there are still enough printable ASCII characters to represent all of the possible patterns.

In other words, the 64 available characters represent all 64 different bit patterns from decimal 0 up to decimal 63.

Differences

Base64 is efficient, but not secure.

Base62 is not efficient, but can be used for some security things like DNS entries, email addresses, and path names.

There is not much ambiguity in [0-9a-zA-Z] – there are multiple common implementations of Base64 because the extra 2 chars it needs always clash with some context or other.

Efficiency

In terms of efficiency, base 62 will never even come close to base64. Base 64 encoding is dead simple: Take 6 bits, map them onto a character, repeat until done.

This is so simple, because 64 is a power of 2. With base 62 however, you will have to convert to an integer and start carrying over the "remainder" with each step, because the patterns do not fit evenly.

AboutContact