The Base64 algorithm is primarily intended to convert binary data into simple text characters. This makes it possible, for example, to include binary data in text messages or text files. Binary data can thus be transmitted in text form over the Internet. The sender only has to encode the data using Base64 and the receiver has to decode it back. As the name suggests, Base64 uses a set of 64 ASCII characters: the Latin capital letters A to Z, the Latin lower case letters a to z, the digits 0 to 9 and the special characters +, / and =.
Through a Base64 encoding, a text is created that consists of only readable, code-page-independent characters. This means that Base64 can also be used to correctly transfer texts created with the character set Unicode or UTF-8. A Base64 encoding is therefore always suitable if text data is transferred and it is not sure whether different character sets or code pages are switched during the transfer. With Base64 it is only important that the correct representation of ASCII characters is always guaranteed.
A typical example for Base64 is the sending of e-mail attachments. Since the protocol for sending e-mails only allows text, attachments must also be converted into text before sending them. The MIME standard describes how this works technically. It is essentially based on the Base64 process. Once an e-mail with file attachment is sent, the attachment is first encoded using Base64 and appended to the text message as a MIME attachment.
Another typical example for Base64 is its use in HTML pages. In the HTML5 standard, it is not only possible to link images used in websites, but to integrate them directly into HTML code or CSS files. Since images consist of binary data, but HTML and CSS code are pure text data, the images must also be represented as text. Base64 is used for this purpose as well. Web developers only need to convert the binary data of the images into Base64 strings. You can use Base64 generators like the one on this page for this purpose.
Input | The Base64 Encoder encodes text to Base64. |
---|---|
Output | VGhlIEJhc2U2NCBFbmNvZGVyIGVuY29kZXMgdGV4dCB0byBCYXNlNjQu |