Base64 Encoding – Standard vs URL-safe

What is Base64?

Base64 is a binary-to-text encoding scheme that converts binary data (images, files, bytes) into a string using only 64 printable ASCII characters. It is widely used when binary data must be embedded in text-based formats such as JSON, XML, email (MIME), HTML data URIs, or HTTP requests.

Standard Base64 alphabet (RFC 4648)

Characters: A–Z a–z 0–9 + /
Padding: = (added so length is multiple of 4)

URL-safe Base64 variant (RFC 4648 §5)

A modified version designed to be safe in URLs, URIs, filenames, and query strings:

This avoids characters that have special meaning in URLs or need escaping.

Comparison Table

Property Standard Base64 URL-safe Base64
AlphabetA–Z a–z 0–9 + /A–Z a–z 0–9 - _
Padding= (usually present)Omitted in most implementations
Safe in URL path/query?No (requires %2B %2F %3D escaping)Yes (no escaping needed)
Common usageEmail (MIME), data URIs, basic authJWT, OAuth tokens, API keys, URL parameters

Encoding Examples

Input bytes (text) Standard Base64 URL-safe Base64 (no padding)
HelloSGVsbG8=SGVsbG8
ManTWFuTWFu
MaTWE=TWE
MTQ==TQ
😊 (UTF-8)8J+Yig==8J-Yig

Live Demo – Encode / Decode

Input

Output

Pure client-side JavaScript • No data leaves your browser • Works offline