Base64 Encode
Convert text into a Base64 encoded string. Full Unicode and emoji are supported through UTF-8, and everything runs locally in your browser.
0 characters
0 characters
About Base64 Encode
This tool provides a simple interface for Base64[2] encoding. It converts any text string into its corresponding Base64 representation, fully supporting the UTF-8[16] character encoding[5] standard. This ensures that all characters, including international symbols and emojis, are accurately processed by first converting the input string into a sequence of bytes (octets) which are then encoded. The output is a plain text string compatible with any system that handles ASCII[1].
At its core, Base64 is a binary-to-text encoding[3] scheme that represents binary data in a radix-64 format. It translates arbitrary binary data into a sequence of printable characters, making it safe for transmission over media that are designed to handle text. The standard Base64 alphabet consists of 64 characters: the uppercase letters A to Z, the lowercase letters a to z, the digits 0 to 9, and the symbols '+' and '/'. This specific set was chosen for its common inclusion in most character sets and its resilience to modification during transport.
The specification for Base64 is formally defined by the Internet Engineering Task Force[10] (IETF) in Request for Comments[15] document RFC 4648[19], titled "The Base16, Base32, and Base64 Data Encodings". This document consolidates earlier definitions and also specifies variant alphabets, such as the "URL and Filename Safe" alphabet which uses '-' and '_' instead of '+' and '/'. The origins of Base64 are found in earlier protocols like Privacy-Enhanced Mail[14] (PEM) and, most notably, the Multipurpose Internet Mail Extensions[12] (MIME) standard, detailed in RFC 2045[18], where it was used to send binary attachments in text-based emails.
The encoding process works by taking a stream of input bytes and processing it in 3-byte (24-bit) chunks. Each 24-bit chunk is then divided into four 6-bit groups. Each 6-bit group corresponds to a number from 0 to 63, which serves as an index to look up a character in the 64-character alphabet. This mapping of 3 input bytes to 4 output characters results in a predictable data size increase of approximately 33%. If the input data is not a multiple of 3 bytes, padding is applied. One or two '=' characters are appended to the output to signal that the original data was 1 or 2 bytes short of a full 3-byte group.
Common applications of Base64 encoding include embedding binary assets like images or fonts directly into text-based documents such as HTML[8], CSS[4], or JSON[11] using the Data URI scheme[6]. It is also used in parts of the HTTP[9] protocol, for example in Basic access authentication. It is crucial to understand that Base64 is an encoding, not encryption[7]. It provides no security or confidentiality, as the encoded data can be trivially reversed. Its purpose is purely for data transport integrity, not for obfuscation[13] or secrecy.
How to Use
- Enter or paste your source text into the 'Input' text area. The tool fully supports UTF-8, including complex scripts and emojis.
- The Base64 encoded result is generated instantly and displayed in the 'Output' text area.
- The process follows the standard Base64 encoding scheme as defined in RFC 4648.
- Click the 'Copy' button to place the entire Base64 string onto your system clipboard.
- To perform a new conversion, click the 'Clear' button, which will empty both the input and output fields.
Frequently Asked Questions
What exactly is Base64 encoding?
Base64 is a method for converting binary data into a text-based format. It uses a 64-character alphabet to represent the data, making it safe to transmit over systems designed to handle only text. It is a form of binary-to-text encoding[3], not an encryption algorithm.
Why do some Base64 strings end with one or two equals signs (=)?
The equals sign is a padding character. The Base64[2] algorithm processes data in 3-byte (24-bit) chunks. If the input data's length is not a multiple of 3, padding is added to the output string to indicate how many bytes were missing from the final chunk. One '=' means the last chunk had 2 bytes, and '==' means it had 1 byte.
Is Base64 a secure way to hide data?
No, it is not. Base64 is an encoding, not a form of encryption[7]. The transformation is easily reversible by anyone with a Base64 decoder. It provides zero confidentiality and should never be used for protecting sensitive information. Its purpose is data transport, not security.
How are emojis and other Unicode characters handled?
This tool correctly handles all Unicode[17] characters by first converting the input string into a sequence of bytes using the UTF-8[16] encoding standard. This byte stream, which can represent any character including multi-byte emojis, is then what gets encoded into the final Base64 string.
What is the difference between standard Base64 and URL-safe Base64?
The standard Base64 alphabet, defined in RFC 4648[19], includes '+' and '/' characters. These characters have special meanings in URLs and filenames. The 'URL and Filename Safe' variant replaces '+' with '-' and '/' with '_'. This tool uses the standard alphabet.
How much larger is Base64 encoded data compared to the original?
Base64 encoding increases the data size by approximately 33%. This is because every 3 bytes (24 bits) of input data are represented as 4 characters (4 * 6 bits = 24 bits) in the output. The ratio of output size to input size is 4:3.
What is a Data URI and how does it use Base64?
A Data URI scheme[6] allows you to embed data, such as an image, directly into a document like an HTML[8] or CSS[4] file. Base64 is used to encode the binary data of the image into a text string that can be included in the URI, for example: `data:image/png;base64,iVBORw0KGgo...`.
Where did Base64 originate?
The concept was developed for early internet protocols to handle binary data in text-only environments. Its most prominent early use was specified for Privacy-Enhanced Mail[14] (PEM) and later standardized as part of the MIME[12] (RFC 2045[18]) specification for email attachments.
Sources (19)
- Wikipedia: ASCII
- Wikipedia: Base64
- Wikipedia: Binary-to-text encoding
- Wikipedia: CSS
- Wikipedia: Character encoding
- Wikipedia: Data URI scheme
- Wikipedia: Encryption
- Wikipedia: HTML
- Wikipedia: Hypertext Transfer Protocol (HTTP)
- Wikipedia: Internet Engineering Task Force (IETF)
- Wikipedia: JSON
- Wikipedia: MIME
- Wikipedia: Obfuscation
- Wikipedia: Privacy-Enhanced Mail (PEM)
- Wikipedia: Request for Comments (RFC)
- Wikipedia: UTF-8
- Wikipedia: Unicode
- IETF RFC 2045: MIME Part One
- IETF RFC 4648: The Base16, Base32, and Base64 Data Encodings
About Matt George
I'm Matt George, a software engineer in the startup space. I run my own shop building software for early-stage founders, and I love making free tools and experiences that people actually use. Enjoy using Base64 Encode!