A free key generator that runs in your browser with crypto.getRandomValues(), plus a calculator that tells you how much entropy a key format really has and how long it should be.
Pick a format and a length, or use a quick preset. Click the output to copy it.
Bits of entropy, the length you need, and the time a brute-force search would take.
Method: entropy = length × log2(set size), valid when a secure generator picks every character uniformly. Count only the random part, not a fixed prefix. Average time = 2bits−1 ÷ guesses per second. Verdicts follow NIST SP 800-57 Part 1: 112 bits minimum, 128 bits beyond 2030.
Every key on this page comes from crypto.getRandomValues(), which browsers back with the operating system's secure random number generator. The script runs in your tab and sends the key nowhere; View Source shows all of it.
Turning bytes into characters is where many generators go wrong. 256 is not a multiple of 62, so the shortcut byte % 62 makes the first eight characters slightly more likely. This page uses rejection sampling: it discards any byte of 248 or more and draws again, so every character has the same chance. Hex and Base64 need no correction, because 16 and 64 divide 256 evenly.
Entropy is the number of bits an attacker has to guess. A 32-character hex key and a 22-character base62 key both carry about 128 bits. A UUID v4 is 36 characters but only 122 bits are random, because its version and variant fields are fixed. Prefixes such as sk_live_ or ghp_ help secret scanners spot a key, but add no entropy.
For an API key or bearer token, 128 bits is a sound minimum and 256 bits a common choice for long-lived secrets: 32 or 64 hex characters, or 22 or 43 base62 or base64url characters. Short codes a person types, such as an 8-character invite code, rely on rate limits and expiry instead.
A browser tool suits test keys and one-off secrets. For production keys your service issues to customers, generate them on the server with crypto.randomBytes (Node.js), secrets.token_urlsafe (Python) or crypto/rand (Go), store only a hash, and show the key once. This page loads Google Analytics and Microsoft Clarity to count visits; the output box is masked from Clarity recordings, but run those commands locally for your most sensitive secrets.
Patterns that well-known APIs use.
sk_live_...Type and mode prefix before a base62 random part.
ghp_...Prefix per token type, easy for secret scanners to spot.
AKIA...20-character key ID plus a 40-character secret.
sk-proj-...Project-scoped secret keys with a readable prefix.
xxxxxxxx-xxxx-4xxx-...36 characters, 122 random bits. Fine as an ID, long for a secret.
a1b2c3d4...4 bits per character. 64 hex characters give 256 bits.
No. The generator runs in your browser and the page makes no request with the key. The page loads Google Analytics and Microsoft Clarity for visit statistics; the key output is masked from Clarity recordings.
Aim for at least 128 bits of entropy: 32 hex characters, or 22 base62 or base64url characters. 256 bits (64 hex or 43 base64url characters) is a common choice for long-lived secrets.
A UUID v4 from a secure generator has 122 random bits, enough to resist guessing. It is long for that entropy, and not every UUID library uses a secure source, so a purpose-built random key is usually better.
Math.random() is not built for security: its output can be predicted from earlier output. Use crypto.getRandomValues in the browser, crypto.randomBytes in Node.js or the secrets module in Python.