How to encode and decode Base64
- Choose Encode or Decode in the toolbar. Encode converts plain text to Base64; Decode converts Base64 back to readable text.
- Paste your input. The result appears instantly — no button press required.
- Choose Standard or URL-safe depending on your use case. URL-safe replaces
+with-and/with_, and removes trailing padding — safe to use in URLs without percent-encoding. - Use Swap to immediately decode what you just encoded, or re-encode decoded output.
Where Base64 is used
Email attachments (MIME)
Email protocols are text-only. Attachments and images are Base64-encoded before being embedded in message bodies.
Data URIs in HTML/CSS
Small images, fonts, or icons can be embedded directly in HTML or CSS as Base64 data URIs to avoid extra HTTP requests.
JSON APIs
APIs that need to pass binary data (images, files, cryptographic keys) through JSON fields use Base64 since JSON is text-only.
JWT tokens
JSON Web Tokens use URL-safe Base64 to encode the header, payload, and signature into a compact, URL-transmittable string.
Basic HTTP authentication
The HTTP Authorization header encodes credentials as Base64: username:password → dXNlcm5hbWU6cGFzc3dvcmQ=
Environment variables and secrets
Binary keys, certificates, and config blobs are often Base64-encoded for safe storage in environment variables or CI/CD secrets.
Standard vs URL-safe Base64
| Property | Standard (RFC 4648 §4) | URL-safe (RFC 4648 §5) |
|---|---|---|
| Characters 62–63 | + and / | - and _ |
| Padding | = (always) | Stripped |
| URL-safe | No (must percent-encode) | Yes |
| Use case | Email, files, general | URLs, JWT, filenames |
Related tools: URL Encode / Decode for percent-encoding URLs, ROT13 Encoder for simple cipher encoding, or Morse Code Translator for a completely different encoding format.
Learn more about Base64
Want a deeper explanation of how base64 works — the 6-bit groups, the = padding, and why it's not encryption? What Is Base64 Encoding? walks through the algorithm step by step with examples.