What is Base64?
Base64 is an encoding method that converts binary data (images, files, bytes) into a text string made of 64 safe ASCII characters (A-Z, a-z, 0-9, +, /). It doesn't encrypt data — it just changes the representation, making binary data safe to include in text-based formats.
When is Base64 Used?
- Email attachments: MIME uses Base64 to embed binary files in email messages.
- Inline images in HTML/CSS:
<img src="data:image/png;base64,..."> - JWT tokens: JSON Web Tokens use Base64URL encoding for the header and payload.
- API authentication: HTTP Basic Auth encodes credentials as Base64.
- Data URIs: Storing fonts, icons, or images directly in CSS files.
Base64 vs Base64URL
- Standard Base64: Uses
+and/characters — not URL-safe. - Base64URL: Replaces
+with-and/with_— safe for use in URLs and JWT tokens.
How to Encode Text to Base64 Online
FAQ
How much bigger is Base64 encoded data?
Base64 encoding increases data size by approximately 33%. This is why inline Base64 images in CSS should only be used for small images — large images should remain as external files.
Why does Base64 end with = signs?
The = character is a padding character. Base64 encodes 3 bytes into 4 characters, so if the input isn't divisible by 3, it pads with one or two = signs.