Base64 Encoder & Decoder Online: Encode and Decode Instantly
Base64 Encoder & Decoder Online: Encode and Decode Instantly
You're setting up Basic Authentication for an API, and the docs tell you to send your credentials as a Base64-encoded string in the Authorization header. Or you've pulled a JWT token apart and you're staring at the payload segment — a block of seemingly random characters — and you need to know what's inside. Or you've got a small icon you want to embed directly in a CSS file as a data URI.
All of these are Base64 problems, and they come up constantly in day-to-day development.
Toolzy's Base64 Encoder/Decoder handles both directions instantly: paste text to get a Base64 string, paste a Base64 string to get the original text back. No install, no account, no rate limits.
What Is Base64?
Base64 is an encoding scheme that converts binary data — or any sequence of bytes — into a string of 64 printable ASCII characters. Those characters are the uppercase letters A–Z, lowercase letters a–z, digits 0–9, plus + and /, with = used for padding at the end.
The name comes from that character set size: 64 characters, each representing 6 bits. Every 3 bytes of input (24 bits) map to exactly 4 Base64 characters, which means Base64-encoded output is always about 33% larger than the original.
Base64 is not encryption. It doesn't protect data from being read — anyone with a Base64 decoder can reverse it immediately. What it does is make arbitrary binary data safe to transmit through systems that only handle text, like HTTP headers, JSON fields, or email bodies.
Why Developers Use Base64
API Authentication Headers
HTTP Basic Auth requires credentials in the form username:password, encoded as Base64 and sent in the Authorization header:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
When you need to test an endpoint quickly — in a terminal, in Postman, or while debugging — encoding your credentials takes seconds with a Base64 tool.
Data URIs for Images and Files
Instead of referencing an external image file, you can embed it directly in HTML or CSS as a data URI:
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..." />
This is common for small icons, favicons embedded in email templates, and SVGs inlined for performance. Encode the raw file content to Base64 and drop it straight into the URI.
Embedding Binary Data in JSON
JSON is a text format. If you need to include a file — a PDF, an image, an audio clip — inside a JSON payload (common in REST APIs and webhooks), you encode it as Base64 first:
{
"filename": "invoice.pdf",
"content": "JVBERi0xLjQKJeLjz9MK..."
}
JWT Payload Inspection
A JSON Web Token has three segments separated by dots. The header and payload are Base64url-encoded (a slight variant of standard Base64 that replaces + with - and / with _). Decoding the middle segment reveals the token's claims — user ID, role, expiry timestamp, and any custom fields.
Email Attachments and MIME Encoding
The MIME standard for email attachments uses Base64 to encode binary file content so it can travel through email servers that expect 7-bit ASCII text. When you open an attachment, your email client Base64-decodes it on the way out.
Configuration and Secret Passing
Kubernetes secrets, Docker environment variables, and CI/CD pipelines often store sensitive config values as Base64-encoded strings. Being able to quickly decode a config value — or encode a new secret before committing it — is a routine sysops and DevOps task.
How to Use Toolzy's Base64 Encoder/Decoder
Head to toolzy.in/tools/base64-encoder-decoder. The interface has two panels.
To encode text to Base64:
- Type or paste your input text into the left panel.
- The Base64-encoded output appears in the right panel instantly — no button to click.
- Hit the copy button to grab the result.
To decode a Base64 string:
- Paste your Base64 string into the right panel.
- The decoded plain text appears in the left panel immediately.
- Copy the output as needed.
The tool handles standard Base64 as well as Base64url (with - and _ instead of + and /), which means it works cleanly with JWT payloads without requiring any manual character substitution.
Base64 vs. Hex vs. URL Encoding
Developers sometimes confuse these three. Here's the distinction:
| Encoding | Characters used | Typical use case | |----------|----------------|-----------------| | Base64 | A–Z, a–z, 0–9, +, /, = | Binary in text: API auth, data URIs, JWT | | Hex | 0–9, a–f | Checksums, cryptographic hashes, color codes | | URL encoding | %XX percent-escaped sequences | Query strings, path parameters |
If you need URL encoding rather than Base64, Toolzy has a separate URL Encoder/Decoder for that.
Common Mistakes and Edge Cases
Padding errors. Standard Base64 strings end with one or two = signs to pad to a multiple of 4 characters. Some systems strip them. If you get a "invalid Base64" error when decoding, try adding = or == to the end.
Line breaks. RFC 2045 specifies that Base64 in email should wrap at 76 characters. Some tools insert these line breaks; others don't expect them. If a long Base64 string isn't decoding correctly, remove all whitespace first.
Encoding vs. Base64url. JWT libraries use Base64url, which swaps + for - and / for _. Toolzy's decoder handles both automatically, but if you're encoding a JWT payload manually, make sure to use Base64url output.
Character encoding of the input. Base64 operates on bytes, not characters. If your input contains non-ASCII characters (accented letters, emoji, CJK characters), the tool encodes the UTF-8 byte representation. The decoded output will round-trip correctly back to UTF-8.
Frequently Asked Questions
Is Base64 the same as encryption? No. Base64 is an encoding scheme, not encryption. Anyone can decode it. If you need to protect data, use encryption (AES, RSA, etc.). Base64 is only for making binary data safe to transmit as text.
What's the difference between Base64 and Base64url?
Base64url replaces + with - and / with _, and typically omits padding =. This makes the output safe for use in URLs and filenames without percent-encoding. JWTs use Base64url.
Can I encode files, not just text? Binary file encoding works differently — the tool on this page handles text strings. For encoding full files (images, PDFs) as data URIs, you'd want to upload the file and have the tool read its bytes directly.
Why is the encoded output longer than the input? Base64 encodes 3 bytes into 4 characters, so the output is always approximately 4/3 the size of the input — roughly 33% overhead. This is the unavoidable cost of making binary data text-safe.
Does the tool store my data? No. All encoding and decoding runs entirely in your browser. Nothing is sent to any server; nothing is logged or stored.
Need to encode or decode a Base64 string right now? Open the Base64 Encoder/Decoder — paste in, get out, done.