API Key Generator (prefixed, with checksum & hash)

Generates API keys with a recognisable prefix such as sk_live_, a secure random body from crypto.getRandomValues, an optional CRC-32 checksum suffix like GitHub tokens, and the SHA-256 hash you should store.

Use the tool

Why this tool exists

Good API keys have a few properties that a quick random string lacks: a prefix that tells you what it is and which environment it belongs to, enough randomness, and a form that scanners can recognise if it leaks. The checksum suffix, as GitHub uses, lets a server reject a mistyped key without a database lookup and helps secret scanners avoid false positives. You also should not store the key itself, only its hash. This tool generates keys with all of these, in the alphabet and length you choose, and shows the SHA-256 hash next to each. Keys are random and created in your browser, but treat anything shown on a web page as an example: for production, generate keys in your own backend.

How to use it

  1. Enter the prefix (for example sk_live_), the number of random characters and how many keys you want.
  2. Choose the alphabet and tick the CRC-32 checksum option if you want it.
  3. Copy the keys and the matching SHA-256 hashes.

Frequently asked questions

Why use a prefix?

A prefix such as sk_live_ shows what a token is and where it belongs, makes leaks easier to find in code and logs, and lets secret scanners recognise it.

What does the checksum do?

A CRC-32 checksum appended as six base62 characters lets a service reject typos or random guesses before touching the database. It is not a security feature on its own.

Why show a hash?

You should store only the SHA-256 hash of a key, so a database leak does not expose working keys. Show the full key to the user once, at creation.

Is the randomness good enough?

The body uses crypto.getRandomValues without modulo bias. For production keys, still generate them server-side, in a place you control.