Base64 Encoder
Runs in browserConvert text to Base64 format
How to Use
Enter text to encode or Base64 to decode. Toggle tabs to switch modes.
You will see:
- Instant Conversion
- Copy-ready Output
- Error Validation
- Safe Local Processing
No output yet
Enter text and click Encode
About Base64 Encoding
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's essential for transmitting binary data over text-based protocols like HTTP, email, and JSON.
Key Features
- Bidirectional: Seamlessly switch between encoding and decoding without reloading.
- Real-time Validation: Checks for valid Base64 characters before processing.
- Privacy Focused: All conversion happens locally in your browser. No data is sent to any server.
- Deep Linking: Share specific strings via URL for quick references.
What is Base64?
Base64 encoding converts binary data (bytes) into a set of 64 printable ASCII characters:
A-Z (26) + a-z (26) + 0-9 (10) + +/ (2) = 64 characters Plus = for padding
How Base64 Works
- Take 3 bytes (24 bits) of binary data
- Split into 4 groups of 6 bits each
- Convert each 6-bit group to a Base64 character (0-63 → A-Za-z0-9+/)
- If input isn't divisible by 3, pad with
=characters
Input: "Hi" → 01001000 01101001 (2 bytes)
Padded: 01001000 01101001 00000000 (3 bytes)
Groups: 010010 000110 100100 000000
Base64: S G k =
Result: "SGk="Common Use Cases
Data URLs
Embed images directly in HTML/CSS using data:image/png;base64,... format.
API Authentication
HTTP Basic Auth encodes credentials as Base64(username:password) in the Authorization header.
Email Attachments
MIME encodes binary attachments as Base64 for transmission in text-based email protocols.
JWT Tokens
JSON Web Tokens use Base64URL encoding (URL-safe variant) for the header and payload sections.
Base64 in Code
JavaScript
// Encode
btoa("Hello World") // "SGVsbG8gV29ybGQ="
// Decode
atob("SGVsbG8gV29ybGQ=") // "Hello World"
// For Unicode (use TextEncoder)
btoa(unescape(encodeURIComponent("Héllo")))Python
import base64
# Encode
base64.b64encode(b"Hello").decode() # "SGVsbG8="
# Decode
base64.b64decode("SGVsbG8=").decode() # "Hello"Important Notes
- Not encryption: Base64 is encoding, not encryption. Anyone can decode it.
- Size increase: Base64 output is ~33% larger than the input.
- URL safety: Standard Base64 uses
+and/which are URL-unsafe. Use Base64URL variant for URLs. - Unicode: JavaScript's
btoa()only works with Latin1. Use TextEncoder for Unicode.
💡 Pro Tips
- Use Base64URL (
-and_) for URLs and filenames - Don't use Base64 for large files — it increases size by 33%
- Base64 padding (
=) is optional in many implementations - This tool processes everything locally in your browser
Further Reading
- RFC 4648: Base16, Base32, and Base64 - The standard specification.
- MDN Web Docs: Base64 - Explanation and usage in web development.