Need to encode text to Base64 for an email, URL, or data URI? Or decode a Base64 string back to readable text? Just paste it in, click encode or decode, and our free tool does it instantly. Works right in your browser — nothing gets sent to a server. Perfect for developers, designers, and anyone working with Base64 data.
Computers store everything as binary — just 1s and 0s. But when you're sending data over the internet, some systems only understand text. They might mess up those 1s and 0s.
Base64 solves this problem. It takes your binary data and converts it into a text string. This text string is safe to send through email, URLs, or JSON files. The receiving end then converts it back to the original data.
The "64" in Base64 comes from the 64 characters it uses. Each character represents 6 bits of data. So it's a base-64 number system, just like our regular numbers are base-10.
This is why Base64 was invented. Old email systems could only handle plain text. To send images or files, email programs encoded them as Base64 text. That's why raw email headers have those long character strings.
Instead of linking to a file, embed image data directly in your code using a data URI: data:image/png;base64,iVBORw0KGgo.... The browser doesn't need a separate request — the image is already in the code.
Some databases don't handle binary well. Developers convert to Base64 text, store that, and decode when they need the original data.
URLs can't have certain characters like spaces or special symbols. Base64 makes data URL-safe. Standard Base64 uses + and / — URL-safe version uses - and _ instead.
That's it. No sign-ups. No ads. No nonsense.
Mistake #1: Thinking Base64 Is Encryption
This is the biggest one. Base64 is NOT encryption — it's encoding. Anyone can decode it. Like writing in pig latin: looks weird, but not secret. If you need to hide data, use actual encryption like AES.
Mistake #2: Adding Extra Whitespace
When copying Base64 strings, extra spaces or line breaks can break decoding. Make sure your string is clean. Our tool automatically trims whitespace, but it's good to check.
Mistake #3: Forgetting the Data URI Prefix
If embedding an image in HTML, you need the full prefix: data:image/png;base64, before your string. Without it, the browser won't know it's an image.
Mistake #4: Using the Wrong Character Set
Base64 works on bytes, not characters. If encoding text, know your character encoding (UTF-8 or ASCII). Encode with one and decode with another = garbage.
Base64 vs. Hex
Hex uses 16 characters (0-9, A-F) — more human-readable but less efficient. Hex = 2× binary size. Base64 = 1.33× binary size. Base64 is more compact.
Base64 vs. ASCII
ASCII represents text characters as numbers. Base64 can encode any binary data (images, files), not just text. ASCII can't handle non-text data.
Base64 vs. Binary
Binary is the raw 1s and 0s — most efficient but not safe for text-based systems. That's exactly why we need Base64 in the first place.
Base64 works in groups of 3 bytes (24 bits), splitting them into 4 groups of 6 bits each. Each 6-bit group (0-63) maps to a character in the Base64 alphabet. Extra bytes get padded with "=" signs.
📊 Encoding "Man" → "TWFu"
What if data isn't a multiple of 3 bytes? That's where "=" padding comes in — 1 extra byte = "==", 2 extra bytes = "=".
URL-Safe Base64
Standard Base64 uses + and / which cause URL problems. URL-safe version replaces + with -, / with _, and drops = padding. Use it when putting Base64 in URLs.
Base64 in Programming
JavaScript: btoa() to encode, atob() to decode. Python: base64.b64encode() and base64.b64decode(). PHP: base64_encode() and base64_decode().
Base64 and File Size
Base64 makes data about 33% bigger (3 bytes → 4 characters). A 100KB image becomes ~133KB in Base64. Don't use it if you're trying to save space.
Base64 was first used in the early 1970s for email under a standard called "Privacy Enhanced Mail" (PEM). That's why you see "BEGIN CERTIFICATE" and "END CERTIFICATE" around Base64 data — a leftover from early email encryption.
The 64 characters were specifically chosen because they're safe — no special meanings in most computer systems. That's why you don't see & or % in Base64.
There's also Base32 (A-Z, 2-7 — less efficient but more readable) and Base16 (hex). Base64 is the most common because it's the most efficient while still being text-safe.
Don't use it for compression. It makes data bigger, not smaller. Use gzip or zip instead.
Don't use it for security. It's not encryption. Anyone can decode it. Use proper encryption like AES.
Don't use it for large files. A 1GB file becomes a 1.33GB string — huge and slow. Use binary transfer for big files.
Don't use it if you don't have to. If both systems support binary, just send binary. Base64 adds overhead for no reason.
No, not at all. Base64 is encoding, not encryption. Anyone can decode a Base64 string with a simple tool. Encryption uses a key to scramble data. Think of Base64 like writing in a different language — it looks different, but it's not secret.
That's padding. Base64 works in groups of 3 bytes. If your data isn't a multiple of 3 bytes, the encoder adds "=" signs to make up the difference. One "=" = 2 leftover bytes. Two "==" = 1 leftover byte. It's perfectly normal.
First, check for extra whitespace or line breaks. Second, check if it's URL-safe Base64 (uses - and _ instead of + and /). Third, make sure the string only contains A-Z, a-z, 0-9, +, /, and =.
Yes. But you need a tool that handles binary data, not just text. Our tool can do it. To use in HTML, add the data URI prefix: data:image/png;base64, before the string.
They're completely different. UTF-8 encodes text characters into bytes. Base64 encodes any binary data (including UTF-8 text) into safe text format. You can have Base64-encoded UTF-8, but they're not the same thing.
Base64 converts 3 bytes into 4 characters — a 33% size increase. It's the price you pay for making binary data safe for text-only systems. If you need to save space, use compression instead.
Use btoa() to encode: let encoded = btoa("Hello World");. Use atob() to decode: let decoded = atob("SGVsbG8gV29ybGQ=");. These are built into modern browsers and Node.js.