What is Base64?
Base64 is an encoding scheme that converts binary data into a text string using 64 characters (A-Z, a-z, 0-9, +, /). It is used to safely transmit data over text-based systems like email, URLs, and APIs that cannot handle raw binary.
Encode vs Decode
Encoding (text → Base64): "Hello" becomes "SGVsbG8=". Use this when you need to embed data in JSON, HTML, or URLs. Decoding (Base64 → text): Paste a Base64 string to see the original content. Useful for reading encoded API responses, email attachments, and data URIs.
URL-Safe Base64
Standard Base64 uses + and / which have special meanings in URLs. URL-safe Base64 replaces + with - and / with _ making it safe to use in query parameters without encoding.
Common Uses
Data URIs: data:image/png;base64,iVBORw... — embed images directly in HTML/CSS. JSON Web Tokens (JWT): The header and payload are Base64-encoded. Email attachments: MIME encoding uses Base64. API authentication: Basic Auth encodes username:password in Base64.
Does Base64 encrypt my data?
No. Base64 is encoding, not encryption. Anyone with the Base64 string can decode it instantly. Never use Base64 to secure sensitive data — use actual encryption (AES, RSA) for security.
Why does Base64 sometimes end with == ?
Base64 encoding works on groups of 3 bytes. If your input isn't a multiple of 3 bytes, padding characters (=) are added to complete the last group. One = means one byte of padding; == means two bytes.
What is the size increase from Base64 encoding?
Base64 increases data size by approximately 33%. Every 3 bytes of input becomes 4 Base64 characters. This is why Base64-encoded images in HTML make pages slightly larger.