Base64 encoding is a method of converting binary data into ASCII text. It's widely used in web development for embedding data in URLs, HTML, CSS, and transmitting binary content over text-based protocols.
How Base64 Works
Base64 encoding converts every 3 bytes (24 bits) of binary data into 4 ASCII characters from a set of 64 characters:
The encoding process:
Common Use Cases
Data URIs
Embed images directly in HTML/CSS:
<img src="data:image/png;base64,iVBOR..." />
Email Attachments
MIME encoding uses Base64 to include binary attachments in text-based email.
API Authentication
HTTP Basic Authentication sends credentials as Base64-encoded strings in the Authorization header.
JWT Tokens
JWT payloads are Base64URL-encoded (a URL-safe variant of Base64).
Base64 vs Encryption
Important: Base64 is NOT encryption. It's an encoding scheme — anyone can decode Base64 data. Never use Base64 alone to protect sensitive information.
URL-Safe Base64
Standard Base64 uses + and /, which have special meaning in URLs. URL-safe Base64 replaces these with - and _ respectively.
Try our Base64 Encoder/Decoder to encode and decode Base64 strings instantly.
