What Base64 Encoding Does
Base64 encoding takes binary or text data and represents it using a set of 64 printable characters: A-Z, a-z, 0-9, plus + and /. The goal is not secrecy or compression, it is safe transport. Many systems were built to handle text reliably but mangle raw binary bytes, so encoding turns any input into a plain ASCII string that survives email headers, JSON fields, and URLs.
The process groups your input into chunks of 3 bytes (24 bits) and splits each chunk into four 6-bit values, mapping every value to one Base64 character. When the input length is not a multiple of three, padding with = keeps the output aligned.
For example, the word Hi becomes SGk=. The encoded string is always larger than the original by roughly 33%, which is the trade-off for guaranteed safe transport across text channels. To reverse the process, use Base64 Decode.
Encoding Text Versus Binary Data
Base64 works on bytes, so the first step is always converting your input into bytes. With plain text, this tool reads characters as UTF-8, meaning accented letters and emoji each expand into multiple bytes before encoding. That is why a short string with non-ASCII characters can produce a longer Base64 output than you might expect.
The table below shows how different inputs map to their encoded form:
| Input |
Bytes |
Base64 output |
A |
1 |
QQ== |
Cat |
3 |
Q2F0 |
Café |
5 |
Q2Fmw6k= |
Notice that Café is four characters but five bytes, because é takes two bytes in UTF-8. Binary data such as images or files follows the same rule: every byte is encoded directly, with no concept of characters at all. If you want to encode an actual file rather than typed text, use File to Base64 instead, which reads the file contents byte by byte. The encoding logic is identical either way, so the only real difference is how the input bytes are gathered before the conversion begins.
Reading Padding and Output Length
The = characters at the end of a Base64 string are padding, not data. They appear because encoding works in groups of three input bytes, and when the final group is incomplete the output is padded to keep a clean four-character block.
The rule is simple:
- Input length divisible by 3: no padding
- One byte left over: two
= signs
- Two bytes left over: one
= sign
You can estimate output size before encoding. For an input of n bytes, the encoded length is 4 * ceil(n / 3) characters. So 10 bytes produce 16 characters, and 100 bytes produce 136 characters.
Knowing this helps when a field has a length limit, such as a database column or a URL parameter. If the encoded value lands in a web address, remember that + and / are not URL-safe and may need additional handling with URL Encode. Padding also lets a decoder know exactly where the data ends, which is why stripping the = signs can cause a strict decoder to reject an otherwise valid string.
Common Places You See Base64
Base64 shows up across the stack once you know what to look for. Email attachments use it through the MIME standard, which is why a raw email source is full of long character blocks. Data URIs embed small images directly in HTML or CSS with a prefix like data:image/png;base64, followed by the encoded bytes.
Web tokens lean on it heavily. A JSON Web Token is three Base64 segments joined by dots, and HTTP Basic Authentication sends credentials as a single encoded string. APIs often accept binary payloads, such as a file upload inside a JSON body, by encoding them first.
Keep in mind that Base64 is encoding, not encryption. Anyone can decode it instantly, so it never protects secrets on its own. It simply makes binary data safe to move through text-only channels. When you need to turn an encoded value back into readable form, Base64 Decode handles the reverse step.
Encoding Safely Without Surprises
A few habits prevent the most common Base64 mistakes. First, confirm the character encoding of your source text. This tool uses UTF-8, which is the modern default, but if your data came from a legacy system using a different encoding, the bytes will differ and so will the result.
Second, watch for hidden whitespace. A trailing newline or stray space in your input becomes part of the encoded bytes, so hello and hello produce different strings. Trim your input when an exact match matters.
Third, decide whether you need standard or URL-safe Base64. Standard output uses + and /, while URL-safe variants swap them for - and _. If the value will travel inside a query string, the safer path is often to encode normally and then apply URL Encode to the surrounding URL.
Because this tool runs entirely in your browser, the text you paste never leaves your device, which matters when the input includes sensitive content.