Base64 & Base64URL Encode & Decode Online
Convert text to Base64/Base64URL encoding or decode Base64 strings back to readable text. Also supports image to Base64 conversion. All processing happens locally in your browser for maximum security.
Encoding Options:
💡 Tip: Use Ctrl + Enter to encode quickly
Image to Base64 Converter
Language | Base64 Encode | Base64URL Encode | Decode |
---|---|---|---|
JavaScript | btoa(str) | btoa(str).replace(/\+/g,'-').replace(/\//g,'_') | atob(base64) |
Python | base64.b64encode(str) | base64.urlsafe_b64encode(str) | base64.b64decode(str) |
PHP | base64_encode($str) | rtrim(strtr(base64_encode($str), '+/', '-_'), '=') | base64_decode($base64) |
Java | Base64.getEncoder().encodeToString(bytes) | Base64.getUrlEncoder().encodeToString(bytes) | Base64.getDecoder().decode(base64) |
C# | Convert.ToBase64String(bytes) | Convert.ToBase64String(bytes).Replace('+','-').Replace('/','_') | Convert.FromBase64String(base64) |
About Base64 & Base64URL Encoding
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. Base64URL is a variant that uses URL-safe characters, making it suitable for use in URLs and file names.
Key Differences:
Aspect | Standard Base64 | Base64URL |
---|---|---|
Character 62 | + | - |
Character 63 | / | _ |
Padding | Required = |
Optional (often omitted) |
URL Safe | ❌ No | ✅ Yes |
Key Features:
- Secure: All encoding/decoding happens in your browser - no data sent to servers
- Fast: Instant processing with optimized JavaScript algorithms
- Real-time: Optional real-time encoding for instant feedback as you type
- Versatile: Supports text, binary data, and image files
- Standards Compliant: Follows RFC 4648 Base64 specification
- Auto-Detection: Automatically detects Base64 and Base64URL formats when decoding
Common Use Cases:
- Base64: Email attachments (MIME), embedded images in HTML/CSS, JSON/XML data
- Base64URL: JWT tokens, OAuth parameters, URL query strings, file names
- Basic authentication headers
- Storing binary data in text-based formats
Example Comparison:
Text: Hello World!
Base64: SGVsbG8gV29ybGQh
Base64URL: SGVsbG8gV29ybGQh
(same in this case)