Base64 URL Encode / Decode
Encode and decode URL-safe Base64 strings. Safe for use in URLs, query parameters, cookies, and JWT tokens.
Last Updated: August 2026
100% Client-Side — Your data never leaves your device
URL-safe Base64 replaces + with - and / with _, and removes trailing = padding. This is used in JWT tokens, URL parameters, and cookies.
URL-Safe Base64 in Code
Encode and decode URL-safe Base64 (no +, /, or padding issues) in your language.
Python
import base64
# Encode to URL-safe Base64 (replaces + with -, / with _)
text = "user@example.com?token=abc123"
safe = base64.urlsafe_b64encode(text.encode()).decode().rstrip("=")
print(safe) # dXNlckBleGFtcGxlLmNvbT90b2tlbj1hYmMxMjM
# Decode URL-safe Base64 (auto-handles missing padding)
decoded = base64.urlsafe_b64decode(safe + "===").decode("utf-8")
print(decoded) # user@example.com?token=abc123
# Convert standard Base64 to URL-safe
std = "abc+def/ghi=="
url_safe = std.replace("+", "-").replace("/", "_").rstrip("=")
print(url_safe) # abc-def_ghiFrequently Asked Questions
Search below or browse through our most commonly asked questions.
Standard Base64 uses '+' and '/' characters which have special meanings in URLs. URL-safe Base64 replaces '+' with '-' and '/' with '_', and removes trailing '=' padding.
Use URL-safe Base64 whenever you need to include Base64 data in URLs, query parameters, or cookies. It's also the standard for JWT (JSON Web Tokens).