Introduction to the

Base64 encryption converts three octet bytes into four six-bit bytes (with less than eight-bit padding 00)

It is one of the most common encoding methods for transmitting 8Bit bytecode on the network

Base64 is a way to represent binary data based on 64 printable characters.

Base64 encoding is a process from binary to character that can be used to pass longer identity information in HTTP environments.

Base64 encoding is unreadable and can be read only after decoding.

base64Features:

  • base64Coding is the basis of modern cryptography;
  • The original group of 8 bits represents data, instead of 6 bits represents data, and the insufficient part is filled with zeros, every two zeros are represented by one =;
  • withbase64After encoding, the data length becomes larger, increasing by about a third;
  • althoughbase64It works as encryption, butbase64Can reverse operation, very unsafe!
  • base64The code has a very striking feature, the end of the ‘=’ sign;

Note: Standard Base64 is not suitable for transfer directly in urls, because the URL encoder converts the “/” and “+” characters in standard Base64 into the form of “%XX”, and these “%” numbers need to be converted when stored in the database, because ANSI SQL already uses “%” as a wildcard.


An improved Base64 encoding for urls not only removes the padded ‘=’ sign at the end, but also changes the ‘+’ and ‘/’ in standard Base64 to ‘-‘ and ‘_’ respectively, thus eliminating the conversion required for URL codec and database storage.