What is Base64?
Base64 is an encoding scheme that converts binary data into ASCII string format. It uses 64 characters (A-Z, a-z, 0-9, +, /) to represent data and is widely used for safely transmitting binary data in email attachments, web APIs, and data transfer.
Use Cases
API Authentication
HTTP Basic Auth encodes username:password in Base64 for transmission.
Image Embedding
Used to embed images directly in HTML/CSS as Data URIs.
Email Attachments
MIME format converts binary attachments to text.
JWT Tokens
JSON Web Token headers and payloads are Base64 encoded.
FAQ
Q. Is Base64 encoding encryption?
No, Base64 is encoding, not encryption. Anyone can easily decode it, so it's not suitable for protecting sensitive data. It should only be used for data format conversion purposes.
Q. What is URL-Safe Base64?
URL-Safe Base64 is a variant that replaces unsafe URL characters (+, /, =) with safe characters (-, _). It's useful when using Base64 strings in URL parameters or filenames.
Q. Why does Base64 encoding increase size?
Base64 converts 6 bits into 8-bit ASCII characters, so the encoded data size increases by approximately 33%. (3 bytes → 4 characters)