Base64 Encoder Decoder

back Updated: December 18, 2023

Encode


Decode


What is base64?

In programming, Base64 is a set of binary-to-text encoding schemes, which are represented by converting data to base 64, and represent binary data in ASCII string format (more specifically, a sequence of 8-bit bytes). The term Base64 is derived from the specific MIME content transfer encoding. Each non-final Base64 number represents exactly 6 bits of data. Therefore, four 6-bit Base64 numbers can be used to represent three 8-bit bytes (that is, a total of 24 bits).

For all binary-to-text encoding schemes, Base64 is designed to store data in a binary format on channels that can only reliably support text content. Base64 is particularly popular on the World Wide Web, and its uses include the function of embedding image files or other binary assets into text assets (such as HTML and CSS files).

Choose different 64 character sets to represent the basic 64-bit value, which differs in different implementations. The general strategy is to choose 64 characters that are common to most encodings and can be printed. This combination makes data less likely to be modified when transmitted through information systems that are not traditionally 8-bit clean, such as e-mail. For example, the Base64 implementation of MIME uses A–Z, a–z, and 0–9 for the first 62 values. Other variants have this attribute, but the symbols selected in the last two values ​​are different. For example, UTF-7.

The earliest examples of this type of encoding were created for dial-up communication between systems running the same OS, such as UNIX's uuencode, TRS-80's BinHex (later for Macintosh), so more assumptions can be made about what. The characters can be used safely. For example, uuencode uses uppercase letters, numbers and many punctuation marks, but not lowercase.