What is an API key generator?
An API key generator makes a random key — a long string of letters, numbers, and sometimes symbols — that identifies a caller to a service. The key on this page starts with a prefix such as sk-, pk-, or test-, followed by random characters. Press the button and a new key appears. Press it again and a different one appears. The default is 32 characters long, starts with sk-, and has 172.7 bits of entropy.
The need is simple: services need a way to tell callers apart and to control who can do what. A key is handed to a developer, the developer sends it with every request, and the service checks it before answering. The prefix tells you at a glance what kind of key it is — a secret key, a public key, or a test key that cannot touch real data.
This generator covers the choices people actually make: a prefix from sk-, pk-, test-, a custom prefix of your own, or no prefix at all; a length from 8 to 128 characters; and toggles for uppercase letters, numbers, and symbols. It shows the total length, the prefix used, and the entropy in bits, so you can see how strong the key is instead of guessing. Everything runs in your browser — the key never leaves your device, nothing is stored, and there is no account to create.
One thing to understand from the start: the keys made here are random strings generated locally. They are NOT issued by any service, and no service will accept them unless you register them with that service first. A generated key becomes a real API key only when you paste it into a service's dashboard and the service stores it as yours.
How an API key generator works
The generator builds a character set from your toggles. Lowercase letters are always included — 26 symbols. Uppercase adds 26 more, numbers add 10, and symbols add 26. With uppercase and numbers on and symbols off, the set is 62 symbols. With everything on, it is 88 symbols. Then it picks one character at random for each position, using Math.random, until the random part is as long as you asked.
The prefix is added in front and is not random: sk- means a secret key, pk- a public key, and test- a test key. The default key is 32 characters in total, so with the 3-character prefix sk-, the random part is 29 characters. The entropy is measured on the random part only, because the prefix is fixed and adds no guessing difficulty at all.
Strength is measured in entropy — bits. Entropy is the random length times log2 of the character set size. The default key has 29 random characters from 62 symbols, and log2 of 62 is about 5.95, so 29 × 5.95 = 172.7 bits. A 16-character key with the test- prefix and symbols on has 11 random characters from 88 symbols, log2 of 88 is about 6.46, and 11 × 6.46 = 71.1 bits.
To see the scale, take a 24-character key with a custom prefix myapp- and only lowercase letters and numbers. The set is 36 symbols, the random part is 18 characters, log2 of 36 is about 5.17, and 18 × 5.17 = 93.1 bits. Every extra random character multiplies the guesses an attacker needs, which is why length matters more than anything else.
Prefixes, length, and what actually makes a key strong
The prefix is a label, not a lock. Services use sk- for secret keys that must stay private, pk- for public keys that can be shown in client-side code, and test- for keys that only work against test data. The letters themselves protect nothing — what protects the key is the random part behind them, and how carefully you store it.
Length is the single biggest factor. Each extra random character multiplies the number of possible keys by the size of the character set. Going from 11 random characters to 29 does not double the strength — it raises it by more than a hundred bits. A 32-character key with the sk- prefix at 172.7 bits is far beyond anything an attacker can guess, while a short key with a fancy prefix is still a short key.
Character sets matter, but less than people think. Adding symbols to a key helps, and adding uppercase helps — but adding characters helps most of all. A 24-character key of lowercase letters and numbers only, at 93.1 bits, beats a 16-character key with every symbol turned on at 71.1 bits. If you remember one rule, remember this: longer beats fancier.
The real enemy is exposure. A strong key pasted into a chat message, committed to a public code repository, or left in a screenshot is a compromised key, no matter how many bits it has. A password generator makes the same point for passwords, and a random string generator makes the same kind of randomness for tokens and test data.
A worked example: three keys, three strengths
Here is a real comparison, using the exact numbers this page shows. First, the default: 32 characters, prefix sk-, uppercase and numbers on, symbols off. The character set is 62 symbols, the random part is 29 characters, the entropy is 172.7 bits, and the total length is 32. That is the key to use for a real service.
Second, a test key: 16 characters, prefix test-, everything on. The character set is 88 symbols, the random part is 11 characters, the entropy is 71.1 bits, and the total length is 16. It is fine for a test environment, where the data is fake and the damage from a leak is small, but it is not a key to trust with real data.
Third, a custom key: 24 characters, custom prefix myapp-, lowercase and numbers only. The character set is 36 symbols, the random part is 18 characters, the entropy is 93.1 bits, and the total length is 24. The custom prefix makes it easy to spot in logs and config files, which is the whole reason to use one.
Notice that the tests only ever check structure — length, prefix, and entropy — never the exact key, because the key is random and a different one appears on every press. That is the honest way to test a random generator: the shape must be right every time, even though the characters are never the same twice.
Who generates API keys, and why
Developers are the main users. Test accounts, staging environments, and new services all need keys before any real user exists, and a generator makes one on demand. The key is then registered with the service, stored in an environment variable, and sent with every request the code makes.
Teams use the generator when they rotate keys. A key that has been shared too widely, or that may have leaked, should be replaced — generate a new one, register it, update the code, and delete the old one. Rotation is a routine habit, and a generator makes it a thirty-second job instead of a project.
Learners use the generator to understand how services identify callers. Making a key, seeing its prefix and its entropy, and then sending it to a service makes the idea concrete: the key is a name tag and a password in one string, and the service trusts it because it issued it, not because it is clever.
For the rest of the toolkit, the companions are nearby. A UUID generator makes unique identifiers for records and requests. A hash generator shows the digests that services use to store keys safely. And a password strength checker judges any secret you are about to trust.
API key generator vs password generator
A key generator and a password generator do the same maths with different labels. Both pick random characters from a set, both measure strength in entropy, and both run entirely in your browser. The password generator makes secrets for people to type and remember; this tool makes keys for code to send, with a prefix that says what the key is for.
The difference matters for storage. A password goes into a password manager. A key goes into an environment variable or a secrets store on a server — never into source code, never into a chat message, and never into a public repository. A key in a public repository is found by scanners within minutes, and it is used within the hour.
A UUID is a different thing again. A UUID generator makes a unique identifier, not a secret: it is meant to be shared, not hidden. A key is a secret by definition. Mixing the two up — using a UUID where a key is needed — leaves the service open to anyone who can guess or list identifiers.
The workflow is the same in both tools: generate, register, store safely, and rotate when in doubt. The generator makes the secret; your habits keep it secret. No tool can do the second half for you.
Common API key mistakes
The most common mistake is committing a key to source code. A key in a Git repository, especially a public one, is found by automated scanners almost immediately. Keep keys in environment variables or a secrets store, and keep the code free of secrets entirely.
Second: using a test key in production. A test key often has fewer permissions, or none at all, and a production system that depends on it will fail at the worst moment — or worse, a test key that does work in production may have been shared widely because everyone thought it was harmless.
Third: never rotating keys. A key that has been in use for two years, shared with three former team members, and pasted into two chat threads is not a secret any more. Rotate on a schedule, and rotate immediately after any suspected leak.
Fourth: treating a generated key as already valid. A key made here is a random string, not a credential. Until you register it with a service, no service will accept it. If a tutorial tells you to paste a generated key straight into an app and expect it to work, the tutorial is skipping the registration step.
How to use this API key generator
Using this API key generator is simple. Pick a prefix — sk- is the default, and it is a good choice for a secret key. Set the length — 32 is the default. Tick uppercase, numbers, and symbols as you like; uppercase and numbers are on by default. If you picked the custom prefix, type your own prefix, such as myapp-. Press Generate API Key, and a new key appears in the box below, with its length, prefix, and entropy shown above it.
To copy the result, use the Copy button next to the output box. To make another one, press the button again — every press makes a fresh key. If the key looks too long to paste where you need it, shorten it to 16 characters for a test key; if it looks too simple, lengthen it to 48 or 64.
Everything runs in your browser. No sign-up, no account, no data sent anywhere — the key never leaves your device, and it is never stored. It works offline once the page has loaded. Remember the one honest limit: the key is random, not issued. Register it with your service before you use it, and store it like the secret it is.
Try it with something real before you need it: generate a test key, register it in a test environment, and send one request with it. Once you have done that, the whole flow — generate, register, store, rotate — is a habit you will keep.