API Key Generator
Generate prefixed, high-entropy API keys with your browser's cryptographic random source.
- Runs locally in your browser
- No upload required
Try it
Supported formats
Privacy
Runs entirely in your browser. Your input is never uploaded, stored, or sent to a third party.
Generated 2 API key(s) with a 32-character secret over the base64url alphabet (192 bits of entropy).
How it works
- Read the optional prefix, secret length, alphabet and count.
- Drew each secret character from the platform CSPRNG over the chosen alphabet with rejection sampling.
- Joined the prefix and the secret with an underscore so the key is recognisable but the secret stays independent.
- A seed was supplied for a reproducible example; real keys use the platform CSPRNG.
- Treat a generated key as a secret: paste it straight into a secret manager and never into a URL or a commit.
Methodology
- Assemble the alphabet for the chosen encoding.
- Draw one character at a time from the platform CSPRNG using rejection sampling, so no character is biased by a modulo shortcut.
- Prefix the secret with the caller's label and an underscore when a prefix is present.
- Report the alphabet size and the entropy estimate length × log2(alphabetSize).
Usage
- Enter an optional prefix such as `sk_live` or `app`.
- Choose the secret length and the alphabet (base62, base64url, hex or base32).
- Generate the key and copy it directly into your secret manager.
Examples
These are examples, not current values: they use fixed inputs, while the interactive tool computes live results in your browser.
Two reproducible base64url keys
{
"prefix": "sk_test",
"length": 32,
"count": 2,
"alphabet": "base64url",
"seed": "example"
}A 48-character base62 key
{
"prefix": "pk",
"length": 48,
"alphabet": "base62",
"seed": "example"
}A 64-character hex key
{
"length": 64,
"alphabet": "hex",
"seed": "example"
}Limitations
A random key is only the beginning
A key generator produces a secret with a known amount of randomness. It cannot scope the key, rotate it or revoke it. Pair it with per-key permissions, an expiry and a rotation policy.
Because the key is a bearer secret, its safety depends on where it is stored. Keep it out of URLs, client bundles and version control; use a secret manager and environment injection.
Frequently asked questions
- How much entropy is enough for an API key?
- 128 bits is the common minimum for a bearer secret. A 32-character base64url secret is about 192 bits, comfortably above that. Use at least that length unless a protocol caps it.
- What does the prefix do?
- It makes the key recognisable in logs and secret scanners so accidental commits can be detected. It is not a security control on its own.
- Is the key transmitted anywhere?
- No. Generation is browser-local via `crypto.getRandomValues`, and the page has no network or storage path.
Sources
Send feedback
Tell us if this tool helped, report a problem, or suggest a tool. Only the message you type is sent — never the input you used in the tool.
Was this tool useful?
Prefer to write to us directly? See the contact page.