What is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's widely used in computing to encode data when there is a need to store or transfer data through a medium that only supports text, such as email systems, HTTP headers, or JSON APIs.
The name "Base64" comes from the fact that it uses 64 printable ASCII characters: A–Z, a–z, 0–9, + and /. Every 3 bytes of binary input is converted to 4 Base64 characters, making the output approximately 33% larger than the input.
Common Uses of Base64
- Embedding images in HTML/CSS as data URIs (data:image/png;base64,...)
- Encoding API keys and credentials in HTTP Authorization headers
- Storing binary data in JSON or XML formats
- Email attachments encoding (MIME)
- Encoding JWT (JSON Web Tokens) payload and header
- Passing binary data in URL query parameters
Frequently Asked Questions
Is Base64 the same as encryption? ▼
No. Base64 is encoding, not encryption. It's easily reversible without any key — anyone can decode a Base64 string back to its original content. Never use Base64 alone to "secure" sensitive data. Use proper encryption for that.
Why does my Base64 string end with == ? ▼
Base64 encodes 3 bytes into 4 characters. If the input length isn't divisible by 3, padding characters (=) are added at the end to make the output length a multiple of 4. One = means 1 padding byte, == means 2.
What is URL-safe Base64? ▼
Standard Base64 uses + and / characters which have special meaning in URLs. URL-safe Base64 replaces + with - and / with _ so the encoded string can be safely used in URL query parameters without percent-encoding.