What Is Base64 Encoding?
Base64 is a binary-to-text encoding scheme that represents binary data using 64 ASCII characters: uppercase A–Z, lowercase a–z, digits 0–9, plus + and /, with = as padding.
It was designed to safely transmit binary data (images, files, audio) through systems that only handle text — like email, HTTP headers, or XML.
Why Is Base64 Used?
- Email attachments — MIME encoding embeds binary attachments as Base64 text.
- Data URLs — Embed images directly in HTML/CSS:
src="data:image/png;base64,..." - API tokens — Basic Auth credentials are Base64-encoded:
Authorization: Basic dXNlcjpwYXNz - JSON payloads — Binary data in JSON must be Base64-encoded since JSON is text-only.
- Cookies and sessions — Store binary session data as text-safe strings.
Base64 Encoding vs Encryption — A Critical Distinction
⚠️ Base64 is NOT encryption. It provides zero security — anyone can decode it instantly. It's simply a way to represent binary data as text. Never use Base64 to "hide" passwords or sensitive data.
How to Encode/Decode Base64 Online
- Visit FavorTool Base64 Encoder.
- Paste your text in the input field.
- Click Encode to convert to Base64 or Decode to reverse it.
- Copy the result with one click.
Base64 URL Variant
Standard Base64 uses + and / which have special meaning in URLs. The URL-safe Base64 variant replaces them with - and _, and omits padding. This is used in JWTs (JSON Web Tokens) and OAuth tokens.
Base64 Encoding Size Overhead
Base64 encoding increases data size by approximately 33%. A 100-byte binary file becomes ~133 bytes when Base64-encoded. This overhead is the trade-off for text compatibility.
Common Base64 Strings You'll See
// "Hello, World!" encoded
SGVsbG8sIFdvcmxkIQ==
// JWT header (Base64URL)
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9
// Small PNG pixel (Data URL)
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJ...