We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Software

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What is Base64?

By S.A. Keel
Updated: May 16, 2024
Views: 7,666
Share

Base64 is a method for converting arbitrary binary data, data comprised of more than just plain text characters, into a plain text message that can then be transferred across a computer network. It's what's called an encoding. While the output of a base64 encoded message is not something a human can readily understand, it is still comprised of 64 common English language characters, which is where the name comes from, with an additional 65th character used for special purposes.

The idea behind base64 came about as the need arose to get more than simple text characters through networked communications such as email. The first email messages started out as characters encoded in the American Standard Code for Information Interchange (ASCII), the encoding method used in computers for representing English language alphabet characters as text on displays or printers. As additional binary information needed to get through, new encoding schemes were developed.

The base64 encoding method was first described in what's known as the Multipurpose Internet Mail Extensions (MIME) standard. The MIME standard defined methods by which other characters that weren't ASCII-encoded, such as alphabets used by non-English languages, as well as other arbitrary binary data, could also be encoded into ASCII sequences and transmitted via email messages. Of the two primary means of encoding described by the MIME standard, base64 shares the role with another known as quoted-printable. While the quoted-printable method is capable of extending ASCII somewhat beyond its limited 94 printable characters, base64 can take any sequence of bytes and convert it into an ASCII sequence.

Base64 needs to take strings of data that wouldn't otherwise meet the ASCII standard and convert them into ASCII. To do this, the encoding method is a process of gathering the data into groups of three bytes and converting them into four numbers that represent corresponding ASCII characters. Since a byte is eight bits, where each bit is represented by either a one or zero, three bytes are linked end to end and the whole sequence goes into a 24-bit buffer. The 24 ones and zeros are then split up into four groups of six bits, where each is then assigned numbers that match an ASCII character.

Since base64 is capable of encoding any binary data, any sequence of bytes can go through the process. There is a catch, however, in those instances where the number of bytes for encoding aren't divisible by three so that the bits can fit into the buffer. If a byte sequence contains, say, four or five bytes, something is still needed to fill the buffer and make up the full 24 bits. In these cases, each missing byte is represented by eight 0s and is subsequently converted into padding characters in the finished encoding. This is where the previously mentioned 65th character comes from, represented in the encoded message with an equals sign (=); it only ever appears at the very end of an encoding should a filler be necessary.

Although base64 was originally devised for transmitting binary data via email messages, its usage has come into play in a number of other areas besides MIME. One such fairly common use is for web databases and applications to encode data for the creation of a uniform resource locator (URL) on a web form. The extensible markup language (XML) also uses a variant that allows for 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.

Share
EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Discussion Comments
Share
https://www.easytechjunkie.com/what-is-base64.htm
Copy this link
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.