← All tools/Generators/Security/API Key Generator

API Key Generator

Generate secure random API keys in your browser — pick a format and length, add an optional prefix, and copy the result.

Entropy (random bits per key)

256 bits

1 key · Hex · 64 characters

Entropy 256 bits of 1,024
Breakdown
FormatHex
Key length64 characters
Prefixsk_
Quantity1
Entropy per key256 bits

How it works

Keys are filled with crypto.getRandomValues() — the browser’s secure random source.
Hex: 2 characters per byte, so a 64-character key uses 32 random bytes.
Base64URL: 6 bits per character, so a 64-character key uses 48 random bytes.
Alphanumeric: each character is one of 62 letters and digits.
Entropy = random bytes × 8 (the prefix adds no entropy).

Default: 64 hex characters = 32 bytes = 256 bits, shown as sk_ + 64 hex characters.

Hex, 64 characters, prefix “sk_”, quantity 1: the tool draws 32 random bytes and encodes them as 64 hex characters, giving one key like “sk_” followed by 64 hex characters, with 256 bits of entropy. Shorten the length to 32 characters and the same setup gives “sk_” plus 32 hex characters — 16 random bytes, 128 bits of entropy.

Frequently asked questions

What is entropy, and why does it matter?

Entropy measures how hard a key is to guess, in bits. A 256-bit key has 2^256 possible values — far beyond any brute-force attempt. Longer keys and bigger alphabets mean more entropy.

How are the keys generated?

In your browser with crypto.getRandomValues(), the browser’s built-in secure random source. No key is sent anywhere or stored.

Why is a 64-character hex key 256 bits?

Each hex character carries 4 bits, so 64 characters need 32 random bytes — 32 × 8 = 256 bits. The length you set is in characters; the entropy shown comes from the random bytes behind the key.

What is Base64URL?

Base64 with - and _ instead of + and /, and no = padding, so the key is safe to paste into a URL or a header without escaping.

Should I use the prefix?

A prefix like sk_ only labels the key so you can recognise it at a glance — it adds no security and no entropy, which is why the bits shown never include it.

More tools

Tell us what you think

Loving this tool, or stuck on something? Tell us — it takes a minute.

We’ll only use your name and email to reply if needed. The tool and page are filled in for you.