Why use a Base64 encoder?
Base64 represents binary data as ASCII text. It's essential for transporting files, images, or data in formats that only accept text (JSON, XML, emails, URLs).
Three common use cases:
- APIs and webhooks → Encode payloads or decode Base64 responses
- HTTP authentication → Verify or create an
Authorization: Basicheader - Emails and MIME → Decode Base64-encoded attachments
How to use the encoder/decoder in 3 steps
Step 1: Paste content
Paste the text to encode or the Base64 string to decode in the input area.
To encode:
user:password
To decode:
dXNlcjpwYXNzd29yZA==
Step 2: Choose operation
- Encode to Base64: Transforms readable text to Base64
- Decode Base64: Retrieves the original content
Step 3: Copy the result
The result displays instantly. For decoded binary files, save the content with the correct extension (.png, .pdf, etc.).
What is Base64?
Base64 is an encoding that represents bytes using 64 characters: A-Z, a-z, 0-9, + and /. The = sign is padding when the length is not a multiple of 3.
Characteristics:
- Size increases by about 33% after encoding
- Result contains only printable ASCII characters
- This is NOT encryption - data remains readable
Encoding example:
Text: "Hello"
Base64: "SGVsbG8="
Base64 variants
| Variant | Characters | Usage |
|---|---|---|
| Standard | A-Z, a-z, 0-9, +, / | Emails (MIME), certificates, general data |
| URL-safe | A-Z, a-z, 0-9, -, _ | URLs, JSON, JWT tokens |
| MIME | Standard + line breaks | Emails (76 characters per line) |
Usage examples
HTTP Basic Authentication
The Authorization: Basic header expects Base64-encoded credentials:
Credentials: admin:secret123
Base64: YWRtaW46c2VjcmV0MTIz
Header: Authorization: Basic YWRtaW46c2VjcmV0MTIz
Data URL for images
Embed a small image directly in HTML/CSS:
data:image/png;base64,iVBORw0KGgo...
MIME attachments
Emails encode attachments in Base64:
Content-Transfer-Encoding: base64
SGVsbG8gV29ybGQh...
Troubleshooting common errors
| Problem | Likely cause | Solution |
|---|---|---|
| Decode fails | URL-safe string | Replace - with + and _ with / |
| Missing padding | Incomplete format | Add = until length is multiple of 4 |
| Unreadable result | Binary data | Save to file with correct extension |
| Double encoding | Encoded twice | Decode a second time |
Best practices
- UTF-8: Always use UTF-8 for text before encoding
- No plaintext secrets: Base64 is not encryption
- Data URLs: Limit to a few KB to avoid page bloat
- Validation: Check the format (standard vs URL-safe) before decoding
FAQ - Frequently asked questions
Q: Does Base64 protect my data?
A: No. Base64 is reversible encoding, not encryption. Anyone can decode your data. Never store secrets without prior encryption.
Q: Why does the size increase?
A: Base64 represents 3 bytes with 4 characters. Size therefore increases by about 33%. This is the cost of text compatibility.
Q: How do I decode a JWT?
A: A JWT contains 3 parts separated by dots: header.payload.signature. You can decode the header and payload individually (they are URL-safe Base64).
Complementary tools
| Tool | Purpose |
|---|---|
| Case Converter | Convert text to uppercase or lowercase |
| Slug Generator | Transform a title into a clean URL |
| Word Counter | Count words and characters in text |
Useful resources
- RFC 4648 - Base Encodings (official Base64 specification)
- MDN - btoa() and atob() (native JavaScript functions)
Privacy commitment
Your input is sent to the CaptainDNS API solely for encoding or decoding. Content is not retained. Only anonymous technical metrics are logged (processing time, input size).