Free Base64 Encoder & Decoder
Convert text or any file to Base64 and back. URL-safe mode, image data URIs, and full offline privacy.
Base64 output
What Base64 is (and isn’t)
Base64 is an encoding scheme that represents binary data using only 64 printable ASCII characters: A–Z, a–z, 0–9, plus + and /, with = as padding. It’s used everywhere text-only channels need to carry binary data — email attachments (MIME), embedded images in HTML/CSS (data: URIs), JSON Web Tokens (JWTs), API request bodies that carry files, PGP messages, and configuration files that need to embed certificates or keys. This free Base64 encoder handles both text and file input, supports URL-safe encoding for use in URLs and JWTs, and does everything client-side — nothing you paste or upload leaves your browser.
Base64 is not encryption. Anyone can decode a Base64 string in less than a second — the process is fully public and reversible without any key. Never use Base64 to protect passwords, API keys, or sensitive data. It only makes binary data safe to transmit through text-only channels; it does not obscure it.
How to use the Base64 encoder
- Pick your mode — Encode (text or file → Base64) or Decode (Base64 → text or image).
- Paste your input into the text box, or click 📎 Encode a file to select any file (image, PDF, ZIP — anything).
- Choose options: URL-safe swaps
+and/for-and_(needed for JWTs and URL query parameters). Remove padding strips trailing=characters. - Click Convert →. The result appears below with size info. If you decoded an image data URI, we render a preview automatically.
- Copy or download using the buttons at the top right.
Common use cases
Data URI images in HTML and CSS
Embed a small icon directly in a stylesheet or HTML file without a separate image request:
<img src="data:image/png;base64,iVBORw0KGgo…">
This trick is great for tiny icons (under 2 KB) and eliminates an HTTP request. Larger images cost more in Base64 overhead (~33% size increase) than they save in request time, so keep it small.
JWT token inspection
JSON Web Tokens have three Base64URL-encoded parts separated by dots: header.payload.signature. Paste each part (or use our dedicated JWT Decoder) to see what’s inside a token from your app’s auth system. The signature can only be verified with the secret; the header and payload are always readable.
Sending files through JSON APIs
REST APIs that only accept JSON can’t carry binary directly. Encode the file to Base64, embed it as a string field, and decode on the server. Common in image-upload APIs, chatbot file inputs, and integration webhooks.
Embedding certificates and keys in config
Cloud config formats like Kubernetes manifests and Terraform sometimes embed X.509 certificates or SSH keys as Base64-encoded strings to keep line breaks and special characters from breaking YAML/JSON parsing.
Email attachments (MIME)
Every attachment you’ve ever sent by email was silently Base64-encoded by your email client, then decoded on the recipient’s side. You never see the encoding, but it’s what makes email attachments work over the ancient text-only SMTP protocol.
URL-safe Base64 explained
Standard Base64 uses + and /, which have special meaning in URLs (+ encodes as space in query strings; / separates path segments). URL-safe Base64 (defined in RFC 4648 §5) swaps them for - and _, which have no special URL meaning. It’s the standard encoding for:
- JSON Web Tokens (JWTs)
- OAuth 2.0 tokens and codes
- URL-embedded data payloads
- Filenames that carry encoded IDs
Enable the “URL-safe” toggle in this tool whenever the output will end up in a URL or JWT. Combine with “Remove padding” to strip trailing = characters — most URL-safe use cases don’t preserve them.
The math of Base64 overhead
Base64 encoding takes 3 bytes of binary and turns them into 4 ASCII characters. That’s a fixed 33% size increase (before padding). A 3 MB image becomes about 4 MB of Base64 text. That overhead is why:
- Data URI images should be tiny (under 2 KB is ideal)
- Uploading large files via Base64 through JSON APIs is slower than uploading them as binary through multipart/form-data
- Databases storing binary as Base64 use 33% more space than storing it as BLOB
For truly large files, use binary transfers and file APIs rather than Base64 embedding.
Base64 encoder comparison
| Feature | This tool | Command-line (base64) | Random online sites |
|---|---|---|---|
| Text encode / decode | ✅ | ✅ | ✅ |
| File upload & encode | ✅ Any file | ✅ CLI | Varies |
| Image preview when decoding | ✅ Auto | ❌ | Rare |
| URL-safe mode | ✅ | ✅ (-w flag) | Some |
| Remove padding | ✅ | Manual | Some |
| Runs offline | ✅ After first load | ✅ | ❌ Many upload |
| Data privacy verifiable | ✅ DevTools shows no requests | Total | Trust required |
Pro tips
- Data URI images should stay under 2 KB. Beyond that, a normal image file with an HTTP request is faster because Base64’s 33% overhead outweighs the saved request.
- JWTs have no padding. Decode a JWT part manually by padding it with
=until length is a multiple of 4, then use our Decode mode. Our tool handles this automatically if you paste in a JWT part. - Base64URL for cookies. If you’re encoding data into a cookie, URL-safe Base64 avoids the encoding issues that
+and/can cause in some browsers and load balancers. - Never Base64 a password. Base64 is not encryption. If you’re storing or sending passwords, use proper hashing (bcrypt, Argon2) or an encrypted vault.
- Big files freeze the UI briefly. Very large file encoding (100 MB+) runs synchronously in the browser and may lock the tab for a moment. This is a browser limitation; the alternative is streaming, which requires a server.
Frequently asked questions (FAQs)
No. Base64 is encoding, not encryption. Anyone can reverse it in less than a second. Never use it to protect passwords, keys, or sensitive data — it only makes binary data safe to transmit as text.
Because 3 bytes of binary become 4 characters of Base64 — roughly a 33% size increase. That’s the cost of representing binary in a text-safe alphabet.
Limited only by your browser’s memory. Files up to about 100 MB encode without issue on modern browsers. The Base64 result is ~33% larger, so a 100 MB file yields ~133 MB of text.
Base64 pads the output to a multiple of 4 characters. One = means the original ended with 2 bytes; two == means it ended with 1 byte. Turn on “Remove padding” if the destination doesn’t need it — JWTs never keep padding.
Yes. The decoder accepts standard, URL-safe, and unpadded Base64 automatically. Invalid characters or malformed input show a friendly error instead of throwing an exception.
We never see your file. Every byte is read via the browser’s FileReader API, converted with btoa/atob, and stays in memory. Open DevTools → Network tab — zero requests fire during conversion.