API Key Generator

Create API keys with prefixes and grouping.

Options

chars

Result

An API key generator with prefixes and grouping

Generate API keys that look like the real thing, with a prefix such as sk_live_, a random part in Base62, hex or Base32, and optional hyphen grouping.

  • Readable prefixes. Presets for sk_live_, sk_test_, pk_live_, api_ and key_, or type your own. A prefix makes leaked keys easy to spot.
  • Random part you control. Choose 16 to 128 characters in Base62, hex or Base32 and see the entropy.
  • Optional grouping. Split the key with hyphens every 4 or 8 characters for keys people read aloud or copy by hand.
  • Batches. Create up to 50 keys at once and download them.

Uses of an API key generator

Create keys for a service, a prototype or a test suite.

  • Issuing keys to customers. Prototype the format of keys before you build the issuing code.
  • Secrets scanning. A distinctive prefix lets scanners find and revoke keys that leak into repositories.
  • Test and staging keys. Make obviously fake keys with a sk_test_ prefix.
  • Internal service keys. Give each internal service its own random key.

API key generator questions

How long should an API key be?

Use at least 128 bits of randomness. That is about 22 Base62 characters, so the default 32 gives roughly 190 bits.

Does the prefix add security?

No. The prefix is not secret and adds no entropy. It helps people and scanners recognise a key, and tells you which environment it belongs to.

Should I store keys as they are?

No. Store only a hash of each key, as you would a password, and show the full key to the user once when it is created.

Can I use these in production?

They are randomly generated and suitable in strength. For real customers, generate keys on your server so they never pass through a browser tab.