KeyForge

Base64URL token generator

Generate cryptographically-random Base64URL tokens from the Web Crypto API. URL-safe, no padding, great for JWTs, API keys, and compact secrets.

About Base64URL tokens

compact, URL-safe, random

What is Base64URL?

Base64URL is a URL-safe variant of Base64 encoding. It replaces + with - and / with _, and strips the = padding characters. The result is a compact, alphanumeric string that can be embedded in URLs and HTTP headers without escaping. A 32-byte input produces a 43-character token.

Why it matters

Base64URL is the standard encoding for JWTs (JSON Web Tokens), OAuth access tokens, and many modern API key formats. It packs more entropy per character than hex — 6 bits per character instead of 4 — so a Base64URL token is significantly shorter than its hex equivalent at the same security level.

No padding, no problems

Unlike standard Base64, the URL-safe variant removes trailing = padding characters. The result is cleaner in URLs and simpler to work with. When decoding, padding can be safely re-added if needed — most modern libraries handle this automatically.

FAQ

about Base64URL token generation
What is a Base64URL token?

A Base64URL token encodes random bytes using a URL-safe character set (A-Z, a-z, 0-9, -, _) with no padding. It's compact, URL-embeddable, and commonly used for JWTs, OAuth tokens, and modern API secrets.

How is Base64URL different from Base64?

Base64URL replaces + with - and / with _, and removes = padding characters. This makes it safe to use in URLs and HTTP headers without additional encoding.

What is Base64URL used for?

JWTs (JSON Web Tokens), OAuth 2.0 access tokens, OIDC id tokens, API keys, password reset tokens, and anywhere a compact random string needs to appear in a URL.

How many bytes should I use?

32 bytes (256 bits) produces a 43-character token, which matches the entropy of most modern API key standards. 64 bytes gives you a 86-character token for extra margin.

More KeyForge generators

pick a variant

UUID V4

Generate random UUID v4 identifiers straight from crypto.randomUUID. RFC 4122 compliant, one or many

Free Open

Hex Token

Generate cryptographically-random hex strings from the Web Crypto API. Choose the byte length, optio

Free Open

API Key Generator

Generate random alphanumeric API keys and secrets. Set a custom prefix to match your service's forma

Free Open

Random Secret

Generate a 64-byte (512-bit) cryptographic secret as hex. Use it for Django SECRET_KEY, Rails secret

Free Open

Questions or feedback?

a reply within 2 business days

Spotted a bug, want a feature, or just have feedback on KeyForge? Send us a note and we will get back to you.

Prefer to talk it through? Book a 30-min call →