Last updated:
API Key Generator: Random Keys and Tokens Online
GeneratorCreate random API keys, secret tokens and UUIDs in your browser. Pick a format, set the length and an optional prefix such as sk_ or api_, then copy one key or up to 20 at once. The keys are made with your browser's Web Crypto API and are not sent to a server or saved.
How to Use the API Key Generator: Random Keys and Tokens Online
- 1
Choose a format: HEX, Alphanumeric, Base64, UUID or JWT-like. HEX is a safe default for most API keys.
- 2
Set the length with the slider. A longer key has more randomness, and 32 HEX characters gives 128 bits.
- 3
Add a prefix if you want one, for example sk for a secret key or pk for a public key. Leave it empty for no prefix.
- 4
Choose how many keys you need, from 1 to 20, and click Generate Keys.
- 5
Copy a single key with its Copy button, or use Copy All to copy the whole list, one key per line.
- 6
Store each key securely and clear the list when you are done. Keys are not saved, so copy what you need first.
Advertisement
Examples
A secret key in HEX
Input
Format: HEX, length: 32, prefix: sk
Result
sk_9f3a1c7e5b2d48a6c0e1f7d3b9a24c58
Example only, because every key is different. 32 HEX characters carry 128 bits of randomness. The prefix is fixed text and adds none.
An alphanumeric token
Input
Format: Alphanumeric, length: 24, prefix: api
Result
api_Qm7ZkR2xT9vBc4NpLa8WdE3y
Example only. Letters and digits are easy to read and copy. 24 characters give about 142 bits of randomness.
A UUID
Input
Format: UUID, prefix: (empty)
Result
3b241101-e2bb-4255-8caf-4136c566a962
Example only. A UUID v4 has the 8-4-4-4-12 layout and 122 random bits. The length slider does not apply to this format.
Common Uses
- Development and testing. Create placeholder keys for a local or staging environment, so you do not reuse a real key while building and testing an API.
- Environment variables and secrets. Generate a random value for a secret in a .env file or a secrets manager, such as a webhook signing secret or an internal service key.
- Keys for your own API. Give each customer or app its own key. A fixed prefix like sk_ or pk_ makes keys easy to recognise in logs and easier to find if one leaks.
- Unique identifiers. Use the UUID format when you need an identifier that is practically unique, such as a record ID or a request ID.
- Sample data and documentation. Make realistic-looking keys for tutorials, screenshots and API docs, then swap in real keys only on your own systems.
Frequently Asked Questions
What is an API key?
An API key is a secret string that identifies an app or user when it calls an API. The server checks the key to decide whether to accept the request and which account it belongs to.
How random are the keys?
They come from your browser's Web Crypto API (crypto.getRandomValues), which is designed for security-sensitive randomness. Each character is picked evenly, with no bias toward any value. The tool shows the bits of randomness for the settings you chose.
How long should an API key be?
Aim for at least 128 bits of randomness. That is 32 HEX characters, 22 or more Base64 or alphanumeric characters, or a UUID v4 at 122 bits. Longer is fine, but beyond 128 bits it adds little practical protection.
Which format should I choose?
HEX is URL-safe and works in most places. Alphanumeric is easy to read and copy. The Base64 option uses the Base64 character set, which includes + and /, so it is not URL-safe. UUID is for identifiers. JWT-like only copies the three-part layout of a JSON Web Token.
Is the JWT-like format a real JWT?
No. It has three dot-separated parts like a JWT, but its signature is random text, not a signature made with a secret key. Do not use it for login or sessions. Use a JWT library on your server for that.
Can I use these keys in production?
The randomness is suitable. How you store the key matters just as much: keep it out of source code, store only a hash of each key on your server where you can, and be able to revoke and rotate keys. If a platform issues keys itself, use its generator.
What does the prefix do?
A prefix such as sk_ (secret key) or pk_ (public key) labels a key at a glance. Stripe, for example, uses prefixes like sk_live_ and pk_live_. The prefix is fixed text and adds no randomness to the key.
Should I use this for passwords?
No. Passwords have their own rules, such as length, mixed characters and not reusing them. Use the Password Generator for passwords and this tool for API keys, tokens and identifiers.
Are my keys sent or stored anywhere?
No. The keys are made in your browser and are not sent to a server or saved. They disappear when you clear the list or close the page.
Guides related to the API Key Generator — Generate Secure Random API Keys Free
Related Tools
Password Generator
Generate strong and secure passwords instantly.
QR Code Generator
Generate QR and barcodes from text, links, or any input.
Lorem Ipsum Generator
Generate placeholder lorem ipsum text for designs and mockups.
Random Text Generator
Generate random characters, words, sentences or paragraphs.