UtilToolkits2026-06-06
Base64 encoding converts binary data into a string of 64 printable ASCII characters — so any file, image, or cryptographic key can travel safely through systems that only handle plain text. That string full of letters, numbers, +, /, and trailing == you keep seeing in JWTs, CSS data URIs, and API payloads? That's Base64. It doesn't encrypt your data; it encodes it. Anyone with a decoder can reverse it instantly. The goal is safe transport, not secrecy. Use the free Base64 Converter on UtilToolkits to encode or decode any string in seconds — no upload, nothing logged.
Base64 is a binary-to-text encoding scheme defined in RFC 4648. It maps every 3 bytes of binary data (24 bits) to 4 printable ASCII characters drawn from a 64-character alphabet: A–Z (26), a–z (26), 0–9 (10), plus + and /. When the input isn't a multiple of 3 bytes, the encoder appends = or == as padding to keep the output length a multiple of 4.
The name comes directly from the alphabet size. The cost: 3 bytes in → 4 characters out, a 33% size increase. That's the one real downside of Base64 — encoded content is bigger than the original.
Base64 is not encryption. It is not a cipher. It is not a hash. Decoding requires no key and takes milliseconds. If you need to protect data, encrypt it first, then Base64-encode the ciphertext for transport.
Take the ASCII string Man (3 bytes: 77 97 110 decimal). In binary:
M = 01001101
a = 01100001
n = 01101110
Concatenate those 24 bits, then split into four 6-bit groups:
010011 | 010110 | 000101 | 101110
19 22 5 46
T W F u
Result: TWFu. Three bytes in, four characters out, no padding needed because 3 divides evenly.
When input isn't a multiple of 3 bytes:
1 remaining byte → 2 Base64 chars + == (e.g. "M" → "TQ==")
2 remaining bytes → 3 Base64 chars + = (e.g. "Ma" → "TWE=")
// JavaScript (browser + Node.js)
btoa('Hello World'); // → 'SGVsbG8gV29ybGQ='
atob('SGVsbG8gV29ybGQ='); // → 'Hello World'
// Node.js — for binary / UTF-8 data
Buffer.from('Hello World').toString('base64');
Buffer.from('SGVsbG8gV29ybGQ=', 'base64').toString();
// Python 3
import base64
base64.b64encode(b'Hello World') # b'SGVsbG8gV29ybGQ='
base64.b64decode(b'SGVsbG8gV29ybGQ=') # b'Hello World'
// Bash
echo -n 'Hello World' | base64 # SGVsbG8gV29ybGQ=
echo 'SGVsbG8gV29ybGQ=' | base64 -d # Hello World
Note: JavaScript's btoa() only accepts Latin-1 strings. For UTF-8 text or raw binary data, use Buffer in Node.js or TextEncoder + a Uint8Array helper in the browser.
<img src="data:image/png;base64,iVBORw0...">. Keep assets under ~4 KB — anything larger belongs as a separate file.+→- and /→_ and drops padding. Paste any JWT into the Base64 Converter to inspect the payload without any library.Authorization: Basic ... header encodes username:password in Base64. This is formatting, not security — always pair with HTTPS.-----BEGIN CERTIFICATE----- blocks are Base64-encoded DER data. Every TLS certificate you've ever seen is Base64 inside.| Encoding | Input | Output chars | Use when |
|---|---|---|---|
| Base64 | Any binary data | A–Z, a–z, 0–9, +/= | Embedding binary inside text systems (email, JSON, HTML attributes) |
| URL encoding | Text strings | %xx hex codes | Passing special characters safely in a URL query string |
For the full breakdown: URL Encoding vs Base64 Encoding: When to Use Each →
The Base64 Converter runs entirely in your browser:
+/=) and URL-safe (-_, no padding) variantsFor inline images, the Image to Base64 tool generates a complete data:image/...;base64, URI ready to paste. And when you're ready to go deeper, see How to Encode and Decode Base64 Strings Online →
No. Base64 is reversible by anyone — no key, no password required. Encryption (AES, RSA) uses a secret key to make data unreadable. Never use Base64 as a security measure.
Padding. Base64 maps every 3 input bytes to 4 output characters. When the input length isn't divisible by 3, the encoder pads the output with = (1 pad) or == (2 pads) to maintain the 4-character block size.
Base64URL is a URL-safe variant: + becomes -, / becomes _, and trailing = padding is omitted. It's used in JWTs, OAuth tokens, and anywhere the encoded string will appear in a URL, because standard Base64's + and / have special meaning in URLs.
Yes — by roughly 33%. Every 3 bytes of input become 4 characters of output. A 1 MB image becomes ~1.37 MB encoded. That's why data URIs are best kept to small icons; large files should be served as separate resources. More: Base64 vs Hex Encoding: Key Differences →
Ready to encode or decode? The Base64 Converter runs in your browser, handles text and files, produces results in under a second — no account, no upload, no trace.