What is Base64?
Base64 represents binary data as ASCII text by mapping every three bytes of input to four characters from a 64-character alphabet (A–Z, a–z, 0–9, +, /). The trailing = characters pad the output to a multiple of four.
Standard vs URL-safe Base64
The standard alphabet includes + and /, which have special meaning in URLs. URL-safe Base64 (RFC 4648 §5) swaps them for - and _ and typically omits the = padding. JWTs use this variant.
Common uses
- Embedding binary data (images, certificates) in text formats like JSON, XML, or HTML.
- HTTP Basic auth headers.
- Data URLs (
data:image/png;base64,…). - JWT header and payload segments.
Base64 is not encryption
Base64 is an encoding, not a cipher. Anyone can decode it. Don't use it to "hide" secrets — use proper encryption instead.