What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It's widely used to embed binary data in text-based formats such as JSON, XML, HTML, email (MIME), and data URIs.
Standard vs. URL-Safe Base64
Standard Base64 uses + and / characters, which are reserved in URLs. URL-safe Base64 replaces them with - and _ and strips trailing = padding, making it safe for use in query strings and file names.
Common Use Cases
- Encoding API keys and tokens for transport in HTTP headers
- Embedding small images as data URIs in HTML and CSS
- Encoding email attachments (MIME Base64)
- Storing binary data in JSON payloads
- Decoding JWT token payloads for debugging