b2KIT

API Key Generator

Generate secure API keys and access tokens with configurable formats, prefixes, and cryptographic randomness.

Tested tool guide Tested browser tools Checked August 15, 2026

What API Key Generator does and how it behaves

This tool builds a random token by combining an optional prefix (like sk_live_ or a custom label) with a body of random characters drawn from a charset you pick - hex, base64url, or alphanumeric - at a length you set. The randomness comes from the browser's cryptographic RNG rather than a simple pseudo-random function. The output is a string that merely looks like a real API key: it has no connection to any actual service, so pasting it into a provider's dashboard as if it were an issued credential will not work.

How the result is produced

1

randomness source

Each character of the token body is drawn using the browser's Web Crypto API (crypto.getRandomValues), a cryptographically secure pseudo-random number generator seeded from OS entropy. This differs from Math.random(), which is not designed to resist prediction and should never be used for anything security-sensitive.

2

format assembly

The final string is prefix + separator + random body, where the body's character set (hex, base64url-safe, or alphanumeric) and length are set independently of the prefix. Length settings apply to the random portion only, so two keys with the same length setting but different prefixes will differ in total string length.

Good uses

  • filling a .env file with a placeholder key while wiring up an integration before the real credential is issued
  • generating a bearer token or shared secret for a self-hosted service or internal script that just needs an unguessable string
  • seeding a test or staging database with distinct-looking API key values for fixtures

Limits and checks

  • the output is not registered, validated, or recognized by any real API provider - it is only a string matching a shape, not an issued credential
  • generated keys are not tracked against each other, so the tool cannot guarantee uniqueness across separate runs; how likely a collision is depends entirely on the length and charset you chose - a short body (for example 6-8 characters) can repeat across enough generations, while a long body (32+ characters) makes collision practically negligible
  • if a browser blocks or lacks the Web Crypto API, this tool's behavior in that case is not documented here; do not assume the output is cryptographically random unless you have confirmed the API was actually available, since matching format or length alone cannot reveal what random source was really used

Common questions

Is the key this generates actually secure enough to use as a real secret?

The randomness itself is cryptographically strong if drawn via the Web Crypto API, but usable security also depends on the length and charset you chose. A short key (say 8 hex characters) is guessable even with perfect randomness. Use enough characters - 32+ hex or base64url characters is a reasonable floor for a real secret.

Can I use the generated string as my production API key with a real service?

No, not with a third-party service - that provider has to recognize the value before it will accept requests using it, and this tool has no way to register anything with them. A self-hosted service or internal script you control is different: if that system is configured to accept a specific value as a valid credential (some store only a hash of the secret, others store it directly), a string generated here can work as a real secret once you register it there.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools