How long should an API key or secret be?
Use at least 128 bits of randomness for anything that protects access (32 hex characters, 22 Base62 characters). 256 bits (32 bytes) is the common choice for webhook and HMAC secrets; HS256 JWT secrets should be at least 32 bytes — we default to 64. Keys are created with crypto.getRandomValues and unbiased sampling, entirely in your browser.
Prefixed keys
Stripe-style prefixes like sk_live_ or pk_test_ make keys recognisable: secret scanners (GitHub, GitGuardian) can spot them in public code, and humans can tell test from live. Choose your own prefix for your API.
FAQ
Should I store API keys in plain text?
No — store a hash (e.g. SHA-256) of the key on the server and show the full key to the user once.
Is UUID v4 a good API key?
It has 122 random bits, enough for IDs, but a Base62 or Base64URL key of 32 bytes is shorter per bit and clearly a secret.
What is this key I found?
Paste it into the API key detector.