Base64 Encode


Base64 and Url Encoding Utility

  1. URL Decode
  2. URL Encode
  3. Base64 Decode
  4. Base64 Encode

What is Base64?

Base64 is a method for converting arbitrary binary data, the data consisting of more than just plain text characters, into a plain text message that can then be transferred over a computer network. This is called encoding.

While the output of a Base64 encoded message is not something that a human can easily understand, it still contains 64 common English language characters, which is where the name comes from, with an additional 65th character used for special purposes. goes.

The idea behind Base64 came about because the need to receive more than simple text characters arose through network communication such as email.

The first email message appeared as alphabetic characters encoded in the American Standard Code in Information Interchange (ASCII), which are used to represent English-language alphabetic characters on a computer as text on a display or printer. is done. To get through the additional binary information, new encoding schemes were developed.

The Base64 encoding method was previously known as the Multipurpose Internet Mail Extensions (MIME) standard. The MIME standard defined methods by which other characters that were not ASCII-encoded, such as the alphabet used by non-English languages, as well as other arbitrary binary data, could be encoded into ASCII sequences and used in email messages. can be transmitted through Of the two primary means of encoding described by the MIME standard, Base64 shares a role with the other known as printable. While the quoted-printable method is able to extend ASCII somewhat beyond its limited 94 printable characters, base64 can take any sequence of bytes and convert it to an ASCII sequence.

Base64 needs to take strings of data that would otherwise not meet the ASCII standard and convert them to ASCII. To do this, the encoding method is a process of collecting data into groups of three bytes and converting them into four numbers that represent ASCII-compliant characters.

Since a byte is eight bits, where each bit is represented by a one or zero, three bytes are concatenated from end to end and the entire sequence goes in a 24-bit buffer. The 24 ones and zeros are then divided into four groups of six bits each, where each is then given a number matching the ASCII character.

Since base64 is capable of encoding any binary data, any sequence of bytes can go through the process. However, there is a catch in cases where the number of bytes for encoding is not divisible by three, so that the bits can fit in the buffer. If a byte sequence consists of four or five bytes, something is needed to fill the buffer and make the whole 24 bits.

In these cases, each missing byte is represented by 8 0s and is later converted to padding characters in the ending encoding. This is where the 65th character mentioned earlier is represented in a message encoded with the equal sign (=); It appears only at the very end of an encoding, should a fill be necessary.

Although Base64 was originally designed to transmit binary data via email messages, its use has played out in many other areas besides mime. One such common use is to encode data to build a common resource locator (URL) on web databases and web forms.

Extensible Markup Language (XML) also uses a variant that allows binary data, such as small images, to be included within XML documents. Other variations exist for encryption methods and other security-related techniques such as hiding passwords.