What is Base64?
Base64 is an encoding scheme that converts binary data into ASCII text. It's commonly used to embed images in HTML/CSS, transmit data over text-only protocols, and encode credentials in HTTP headers. The encoding increases data size by roughly 33%, but ensures safe transmission through systems that only handle text.
Common Use Cases
- Email Attachments: MIME uses Base64 to encode binary files for email transmission.
- Data URIs: Embed images directly in CSS or HTML without external file requests.
- API Tokens: Many authentication systems encode credentials or tokens in Base64.
- JSON Payloads: Include binary data within JSON by Base64-encoding it first.
Important Notes
Base64 is an encoding method, not encryption. It provides no security—anyone can decode Base64 strings. Never use Base64 alone to protect sensitive data; combine it with proper encryption when security is required.