What is Base64? Encoding explained (with examples)
Base64 is an encoding that turns binary data (bytes) into text using a limited alphabet. It’s commonly used to embed images (data URIs), send binary safely in JSON, or move data through systems that expect text.
What Base64 is (and isn’t)
- Base64 is not encryption. Anyone can decode it.
- Base64 increases size by about 33%.
- Base64 is reversible—it’s meant for compatibility, not secrecy.
Common use cases
- Data URIs (small assets embedded directly in HTML/CSS)
- APIs that transport binary inside JSON payloads
- Emails and MIME attachments
- JWTs use a URL-safe Base64 variant (Base64url)
Standard Base64 vs Base64url
Base64url is a URL-safe variant used by JWTs. It swaps characters
like + and / for - and
_ to avoid URL escaping.
Read the full breakdown: Base64url vs Base64 .
Examples
Encode plain text
Input: hello
Output: aGVsbG8= Decode a Base64 string
Input: eyJmb28iOiJiYXIifQ==
Output: {"foo":"bar"} Try it instantly
Use the tool page to encode/decode text, images, JSON, and files: Base64 Encoder & Decoder .
Related
- Base64url vs Base64 (JWT-friendly encoding)
- JWT Decoder (JWTs are Base64url encoded)
- JSON Formatter (format JSON before encoding)
- All tools