Free · runs in your browser

API Key Generator

API Key Generator. Choose a prefix style and click Generate to build a realistic API key with a cryptographically random suffix. You can generate an uuid in seconds with a free tool that runs entirely in your browser.

Your values

Generate 1 to 500 keys at once.

Alphanumeric or Base64url are the safest choices for URLs and headers.

Random characters after the prefix. 32 or more is recommended for production.

Adds a separate secret to each key: the key identifies the client, the secret proves it.

Example key configuration

Builds a sample config for the first key. Scopes are enforced by your server, not by the key.

Result

Generated API key
—
Secret for this key
—
All generated keys (copy)
—
Entropy per key
—
Random characters
—
Keys generated
—
Example key configuration
—
  • No account, no logging
  • Open formulas explained below
  • Works offline once loaded

Need a credential for a new integration in the next five minutes? This API key generator builds a cryptographically secure random string right in your browser, so you can copy it into your environment variables and move on. Pick a format, a length and an optional prefix, and you get API keys and tokens made from random bytes, with the entropy in bits shown beside the result.

How the API Key Generator Tool Works

A random key generator does one job: it asks your browser for unpredictable bytes and turns them into text that a server can compare against a stored value. The tool reads those bytes from the Web Crypto API, the same cryptographically secure source (a CSPRNG) your browser uses for HTTPS, so nothing is sent to a server and the output has real randomness rather than pseudo-patterns. Because everything runs client-side, the page keeps working even if you disconnect from the internet. If you want to generate a django secret key, a free tool is ready to use right here, with no account or install.

Key length

The key length counts characters after the prefix. Short keys are easy to brute-force, so most teams start at 32 characters for production and go higher for payment or admin access. Longer keys are exponentially harder to brute force, which is why the length matters more than any clever character mix.

Key format

The key format decides which characters can appear. Each option below uses the same random bytes and only changes how they are encoded:

  • Alphanumeric (A-Z, a-z, 0-9): 62 characters, safe in URLs, accepted almost everywhere.
  • Hexadecimal (0-9, a-f): 16 characters, compact and easy to read in logs, but only 4 bits of entropy per character.
  • Base64: 64 characters, the densest text encoding, though it includes + and /. Standard Base64 suits binary secrets, while Base64url suits anything placed in a link; if you are unsure, Base64 is the safe default for storage and Base64url for transport. Both Base64 forms outstrip hex for density.
  • Base64url and URL-safe output: swaps those two symbols for - and _ and drops padding, the form used in JWT and OAuth.
  • UUID v4: a standard 36-character layout with 122 random bits.

Character sets, slider and local storage

Drag the length slider and toggle uppercase, lowercase and numbers to match what your target service accepts. Each toggle widens the pool, which raises the strength of every character. Add symbols only when the receiving system allows them. If you prefer hex, the tool prints the same random bytes as a plain hex string. Recently generated values live in your browser's local storage for convenience, so clear that history on a shared machine and never treat it as secure storage.

Key Length and Entropy: How Strong Are Your Generated API Keys

Strength is measured in entropy, the number of bits an attacker would have to guess. Every character adds a fixed amount, and the total follows one formula:

$$H = L \times \log_{2}(N)$$

Here \(H\) is the entropy in bits, \(L\) is the number of random characters and \(N\) is the size of the character set. The search space is \(N^{L}\), and the time to exhaust half of it at \(r\) guesses per second is:

$$\text{years} = \frac{N^{L}}{2 \times r \times 31{,}557{,}600}$$

Worked example: a 40-character alphanumeric key

Say you set the length to 40, choose alphanumeric and add the prefix svc_live_ for a billing service. The prefix is only a label, so just the 40 random characters count. With \(N = 62\), each character adds \(\log_{2}(62) \approx 5.954\) bits, so \(H = 40 \times 5.954 = 238.2\) bits. The search space is about \(4.96 \times 10^{71}\) combinations. Even an attacker making a trillion guesses per second would need roughly \(7.9 \times 10^{51}\) years to cover half of them.

Worked example: a 40-character alphanumeric key
Key formatCharactersBits per characterTotal bits
Alphanumeric, 24 characters625.95142.9
Alphanumeric, 40 characters625.95238.2
Hexadecimal, 48 characters164.00192.0
Base64url, 43 characters646.00258.0
UUID v4, 36 charactersn/an/a122.0
Numeric, 20 digits103.3266.4

Read the table as a ladder: anything near 128 bits already resists brute-force attacks, which is why the NIST guidance for cryptographic keys is built around that level. Numeric output lands far below it and belongs to PINs and short verification codes, never to a bearer token.

Custom Prefixes and Key-Secret Pairs

Custom prefixes

A prefix such as sk_, pk_ or test_ tells you at a glance what a string is and where it belongs. Custom prefixes also help secret scanners catch a leaked key in a public repository, and they keep environment separation obvious: a test_ value should never open a production door. You can generate a rails secret key base in seconds with a free tool that runs entirely in your browser.

Key-secret pairs

With key-secret pairs the tool returns two values. The public key identifies the client and can appear in logs, while the secret key proves ownership and is used for HMAC signing, so it is never logged and is stored encrypted. AWS access key IDs and OAuth client credentials work this way. You can also bulk generate several keys at once and copy them or export the batch as JSON or CSV.

How to Generate Secure API Keys Online

  1. Set the length. Use at least 32 characters for production and 24 or more for development.
  2. Choose the format that your service accepts, for example alphanumeric for a REST API or Base64url for a signing secret.
  3. Add a prefix that names the key type and the environment.
  4. Press the generate button, then copy the key straight into a secrets manager or your environment variables.

If you only want a quick check, use the tool to generate random API keys in a few formats and compare the entropy figures before you commit to one. Teams that need to generate API keys for several services can repeat the steps once per service so that no two systems ever share a credential. When you generate API keys for a test environment, give them a visible test_ prefix and shorter lifetimes than their production twins, and keep the two sets in separate configuration files.

Treat an API token the same way: API tokens are random strings with a purpose, and the best choice for your project is the one that lets you pick the length, format and prefix yourself, then run it again when it is time to replace the value. Whenever you generate API key values for a new client, make each one unique, easy to revoke and impossible to guess. Run the generator again whenever you need a replacement; each result is independent and unique, so store these API keys with the same care as any other secret.

Issuing Secure API Keys for a Courier Tracking Integration

Priya Raman, a backend developer at a small online shop, has to give a courier partner read-only access to order status. The partner's security questionnaire asks for a key that clears the 128-bit minimum from NIST guidance, and the shop's own policy wants at least 150 bits for anything touching customer addresses.

She opens the generator, selects alphanumeric, types the prefix trk_prod_ and starts with a length of 20. The entropy readout shows 119.1 bits (20 × 5.954), which is under the partner's 128-bit line, so she moves the slider to 22. The readout now reads 131.0 bits: compliant for the courier, still short of the shop's 150-bit rule.

Setting the length to 26 gives 154.8 bits, so she keeps 26. The generator returns a 35-character string once the prefix is attached, and she copies it directly into the hosting dashboard's environment variable instead of pasting it into chat. Because the courier only reads data, she scopes the key to the orders:read permission and sets a 90-day expiry; the reminder to replace it goes into the team calendar for the week before that date.

The decision the number made was concrete: 22 characters would have satisfied the questionnaire, but only 26 satisfied her own policy, and without the readout she would have shipped the shorter key.

Where Generated API Keys Are Used

An API key identifies an application, not a person, which is why it is common in machine-to-machine traffic. Typical jobs include the following, and each tends to want a different shape:

  • REST API authentication with a bearer token sent in the request headers.
  • Webhook secrets that sign each payload with an HMAC so the receiver can verify it.
  • Service-to-service credentials between a microservice and its database.
  • Client application identifiers for a mobile app or single-page app.
  • Rate limiting keys that let a provider meter usage per client.
  • CI/CD secrets that deploy code to staging and production.

Large providers publish their own prefixes, which is a useful model for naming your own:

Where Generated API Keys Are Used
ProviderTypical prefixPurpose
Stripesk_live_Server-side payment access
GitHubghp_Repository access token
AWSAKIACloud access key ID
OpenAIsk-Model access
SendGridSG.Email delivery

Security Standards Behind a Secure API Key Generator

A secure API key generator is only as trustworthy as its randomness. Look for a CSPRNG that follows NIST standards, because predictable output defeats every other safeguard. Good security also means the key is never exposed in client code, screenshots or public repositories; an exposed key should be treated as compromised and replaced on the spot. Many teams map this to compliance requirements that demand documented rotation and access control, so write down who may create, view and revoke each key. Encryption protects the stored value, and authentication logic on the server compares an incoming key against a hashed copy instead of the raw secret, much like a password. Together, these practices turn one random string into a dependable security layer for your authentication flow. Good security habits also cover logging: record which key made a call, never the key itself, so security reviews have evidence without creating a second leak.

Plan your rotate schedule before launch: decide how often to rotate, how two keys can stay valid during the switch, and which team owns the change; the replacement comes from the generator with the same settings, and the old value is then retired. Secure storage means a vault or secrets manager, not a spreadsheet or a shared document.

API Key Best Practices for Developers

A strong random value only helps if you handle it well, so follow these API key best practices from the first day:

  • Never hard-code a key in source files, because version control keeps it in history even after you delete it.
  • Keep keys in environment variables or a secrets manager that records audit logs.
  • Use separate keys for development, staging and production.
  • Apply least privilege: scope each key to the permissions it needs and set an expiration date.
  • Serve keys only over HTTPS and never send them in query strings.
  • Complete a key rotation on a schedule, and immediately after a team change or an exposure.
  • Share a key through an encrypted one-time link, never through chat or email.

Avoid symbols when a key travels in a URL, since characters that need percent-encoding cause failures in shells and query strings.

API Keys vs OAuth and JWT

An API key is the simplest form of authentication: one static secret, one client. OAuth issues short-lived tokens with scopes after a user grants consent, and a JWT carries signed claims that a server can verify without a lookup. Permissions are where the three differ most: an API key often grants access to everything its owner can do unless you add scopes, while OAuth bakes permissions into each token. Authentication with a bare key proves only that the caller holds the string, so pair it with IP allow lists or request signing for sensitive routes, and keep authentication errors vague so attackers learn nothing. Reach for an API key when you control both ends, and for OAuth when users delegate access to outside apps. A GraphQL endpoint often pairs a key with fine-grained permissions on each query, while a simple REST route may only need one key per client; either way, each client gets its own generated key.

Frequently Asked Questions

Does the prefix add any real security?
No -- the prefix is purely cosmetic and organizational (it lets you and automated scanners like GitHub's secret scanning instantly identify what kind of key a string is at a glance). All of the actual unguessability comes from the random suffix; a recognizable prefix doesn't weaken a key's security, since the prefix itself is never secret.
Why do real services like Stripe use prefixes like sk_live_?
It lets both humans and automated tooling identify a leaked credential's type and severity instantly -- sk_live_ signals a live secret key needing immediate rotation, while pk_live_ signals a publishable key that's safe to expose client-side by design. Following the same convention in your own API makes leaked-key triage much faster.
How long should the random part be?
32 characters (the default) from a 62-character alphanumeric set gives roughly 190 bits of entropy, far more than needed to resist brute-forcing. Go shorter (16-20) only if your system has a strict length constraint; there's little benefit to going much longer.
Can I use this as a real production API key?
The key itself is generated with genuine cryptographic randomness and is suitable for production use, but you're responsible for hashing it before storing it server-side (never store API keys in plaintext, the same way you'd never store a password in plaintext) and for building proper revocation and rotation support around it.
Is the generated key sent anywhere?
No. It's generated entirely in your browser using the Web Crypto API's cryptographically secure random number generator -- nothing is transmitted, logged, or stored.

About the author

Vinitha Pu

Founder and designer

Vinitha Pu is a graphic designer based in Palakkad, Kerala, who builds free, privacy-friendly browser tools. She studied Textile and Apparel Design at Avinashilingam University and completed a C-Tech in Graphic Design at Image Creative Education in 2025. She designs, builds and maintains the password generators, strength checkers, hash tools and security calculators on PasswordHive.

  • Content author: Vinitha Pu
  • Fact checked by: Vinitha Pu. Each tool's output is checked against official test vectors or a reference implementation, and every strength and crack-time figure against the formula it uses, before it goes live.
  • Published Updated