Features
- Standard Base64 encoding (RFC 4648)
- URL-safe Base64 encoding (RFC 4648 Section 5)
- UTF-8 character support
- Automatic padding handling
- URL-safe character substitution (
+→-,/→_)
Use Cases
API Authentication
Encode credentials for Basic Authentication headers
URL Parameters
Safely encode data for inclusion in URLs using URL-safe variant
Data Transmission
Encode binary-safe text for transmission over text-only protocols
Email Encoding
Encode non-ASCII characters in email headers (MIME)
Actions
Default (Encode)
Standard Base64 encoding with+ and / characters:
Decode
Decode Base64 back to plain text:URL-Safe Encode
Encode with URL-safe characters (no padding):URL-safe encoding replaces
+ with -, / with _, and removes padding = characters.Input Formats
Plain Text
Any UTF-8 text including international characters:Base64 String (for decoding)
Standard or URL-safe Base64:Examples
- Encode Text
- Decode Base64
- URL-Safe Encoding
- UTF-8 Support
Convert plain text to Base64.Input:Output:
Implementation Details
Fromlib/tools/engine.ts:396-404:
UTF-8 Handling
The tool uses a two-step encoding process for proper UTF-8 support:- Encode:
text → encodeURIComponent → unescape → btoa - Decode:
base64 → atob → escape → decodeURIComponent
Common Patterns
Basic Authentication Header
Encode credentials for HTTP Basic Auth:URL-Safe Token
Create URL-safe tokens:Data URLs
Base64 is commonly used in data URLs (see Base64 Image tool):Padding Rules
Standard Base64: Always includes
= padding to make length multiple of 4URL-Safe: Padding is optional and removed for cleaner URLs| Input Length | Padding |
|---|---|
hello (5) | aGVsbG8= (1 pad) |
hello! (6) | aGVsbG8h (no pad) |
hello!! (7) | aGVsbG8hIQ== (2 pads) |
Error Handling
Invalid Base64 Input
If decoding fails, you’ll see:Common Issues
- Missing padding: The decoder automatically adds padding
- URL-safe characters: Automatically normalized during decode
- Whitespace: Trimmed automatically
Related Tools
- Base64 Image - Encode/decode image data URLs
- URL Encode/Decode - URL percent encoding
- JWT Debugger - Decode Base64-encoded JWT tokens