API Key Generator
SecurityGenerate cryptographically secure API keys in hex, base62, or prefixed formats. Choose key length and format. Runs entirely in your browser — nothing stored.
What is a API Key?
An API Key Generator is a tool that produces cryptographically random secret tokens used to authenticate programmatic requests to an API, service, or system. API keys are how a server verifies that a request comes from an authorised client — they function as machine credentials, similar to passwords, but longer, fully random, and always stored programmatically rather than memorised.
The key quality that matters for an API key is unpredictability: it must be impossible for an attacker to guess the key even if they know the format, the system, or other keys issued by the same service. This tool uses crypto.getRandomValues(), the same cryptographic random source used by TLS key generation and browser-based cryptography libraries, ensuring every key is drawn from a uniform distribution with no exploitable pattern.
Generated keys run entirely in your browser with no server involvement. Nothing you generate is transmitted, logged, or stored anywhere — the value exists only in your browser tab until you copy it and close the page. For a unique identifier that doesn't need to be secret, use the UUID Generator instead. For a human-memorisable credential, the Password Generator is the right tool.
How to use this API Key calculator
- Select the Key Format — Hex for universal compatibility, Base62 for maximum entropy density, Prefixed if you want a self-describing key, or UUID-style for RFC 4122 compliance.
- If using the Prefixed format, enter your Custom Prefix — for example
sk_live,pk_test, orwebhook_v2. - Set the Key Length — 32 is the recommended default; increase only if your system policy requires it.
- Set Number of Keys to how many you need — up to 10 at once.
- Review the generated keys in the output panel.
- Click the copy icon to copy all keys to your clipboard, then store them immediately in your secret manager,
.envfile, or key vault. Do not leave secrets in your browser history or clipboard longer than necessary.
Formula & Methodology
The generator uses two character pools: - Hex:0123456789abcdef(16 characters — 4 bits per character) - Base62:0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ(62 characters — ~5.95 bits per character) For each character in the key body, a 32-bit cryptographically random integer is drawn fromcrypto.getRandomValues()and reduced modulo the pool size to select a character. This is the same approach used by most production cryptographic key generators. Entropy by format and length: | Length | Hex (bits) | Base62 (bits) | |--------|-----------|---------------| | 16 | 64 | 95 | | 32 | 128 | 190 | | 64 | 256 | 381 | The UUID-style format uses 128 bits of raw random bytes, sets 6 bits to fixed values (version 4 marker and variant bits), leaving 122 bits of actual entropy — formatted as the standard 8-4-4-4-12 hex string with hyphens. The Prefixed format takes a user-supplied alphanumeric prefix (sanitised to remove any special characters), appends an underscore separator, then generates the random body using the base62 pool at the specified length. The prefix itself contributes no entropy — all randomness comes from the body.