API Key & PIN Generator
Generate prefixed API keys and numeric PINs by the batch — on a page that stores nothing and sends nothing.
Plain random strings, raw bytes and nonces: Random String Generator
Jump to output| Label | Value | Bits | Copy |
|---|
Download writes these credentials to your disk as a plain-text file.
Press ? for shortcuts · Every row is drawn in memory and never written to storage or sent anywhere.
This page loads no third-party code — no ads, no trackers, no analytics. Verify in your Network tab.
Do it offline:$ printf 'sk_live_%s\n' "$(openssl rand -hex 16)"
How to use it
- Pick the mode: Key for a prefixed credential, PIN for digits only.
- In Key mode set the prefix, separator, body length and draw set — alphanumeric, lowercase, hex, Base32, Base64URL, digits or your own characters.
- In PIN mode set the digit count and tick any rules; the tool prints how many PINs they leave and the cost in bits.
- Add a group size to break the body with hyphens, then the row count and the label stem the export keys come from.
- Press Generate, or ⌘/Ctrl + Enter, then copy a row or download CSV, JSON lines or .env.
Choose Key or PIN, shape it, then issue as many rows as you need. A key is a prefix, a separator and a random body drawn from the set you pick, optionally grouped; a PIN is digits, with optional rules. Rows are labelled and export as CSV, JSON lines or .env. Values are drawn on this device and never stored or sent. For plain strings or raw bytes, the random string generator is the right page.
How it works
A rule does not add difficulty — it deletes candidates. The tool counts the survivors exactly, walking the digit positions and carrying, for each ending digit, how many legal PINs reach it; a forbidden neighbour is simply a transition never taken, and blocklisted PINs still standing are then subtracted one by one. At four digits, no equal neighbours, no neighbours one apart and no obvious PIN leave 3,632 of 10,000 — 11.83 bits per draw where an unrestricted PIN carries 13.29.
The draw is uniform over exactly those survivors, so log₂ of their count IS the entropy, and the page prints both numbers instead of a verdict. Key mode is the same accounting from the other side: only the body is drawn, so bits are its length times log₂ of the set size — 32 alphanumeric characters give 190.53. A prefix, a separator and every inserted hyphen are identical in each row, so an attacker already has them: they lengthen the string and add nothing.
Examples
key · sk_live + _ · 32 alnumsk_live_9PZbyg8RE9hU62GguExu0p9IVtBkwC9UThe Stripe-style shape: 32 body characters over 62 symbols are 190.53 bits; the eight leading characters are structure, not secret. Random output, so it is illustrative — checked by shape, not bytes.
pin · 4 digits · all three rules0949All three rules on: 3,632 of 10,000 four-digit PINs remain — 11.83 bits instead of 13.29. The leading zero is part of the PIN and survives copy, CSV and .env.
dotenv · 3 rows · STRIPE_KEYSTRIPE_KEY1=5NTWTC2BTWEW6C4G4QLXL7RI
STRIPE_KEY2=4Q6NHIAX5JDM3BZAITVYTDI4
STRIPE_KEY3=YI6GRK3KEY5LQ6HRCEYW73PQThree rows as environment lines: the stem gains the row number, dots and hyphens fold to underscores, the key is upper-cased. Base32 is 32 symbols, so 24 characters are 120.00 bits.
Every example on this page is executed against the same engine that powers the tool, on every build.
Gotchas worth knowing
A leading zero is part of the PIN
PINs are text from the draw onward, so 0949 stays four digits in the table, the clipboard and every export.
Rules shrink the pool
Each rule deletes candidates, and fewer candidates mean fewer bits; the surviving count sits beside the figure. A combination leaving nothing refuses rather than drop a rule for you.
Grouping writes real hyphens
A group size puts hyphens in the value, not merely in how it is shown, so a grouped key survives copy and dictation — whatever consumes it must accept them.
A prefix labels, it does not protect
sk_live_ tells a reader, a log parser and a secret scanner what they have — worth setting for that reason, worthless as a guard. Only the body is unpredictable.
Between visits, nothing is left
No preference, batch or value is written to this browser. A shared link carries settings only, and a credential-shaped prefix or label is called out rather than kept.
Common errors
Prefix and separator take up to 32 characters from A–Z, a–z, 0–9, dot, underscore or hyphen.- A space, slash or colon stops the batch — these parts travel through logs and shells verbatim.
Labels take up to 32 characters from A–Z, a–z, 0–9, dot, underscore or hyphen.- The stem must also start with a letter: export keys are built from it, and a key beginning with a digit is invalid.
The custom character set is empty — add characters to draw from.- Your own draw set is selected but holds nothing distinct to pick from.
PIN length must be a whole number between 3 and 16.- Counts outside the band, and fractions, are refused, not rounded.
Key length must be a whole number between 4 and 128.- The body is the only part carrying bits, so its length is bounded, never adjusted.
Group size must be a whole number between 0 and 16, where 0 turns grouping off.- Zero is the off switch; anything else is characters per group.
Count must be a whole number between 1 and 1,000.- A thousand rows arrive at once; more, or none, refuses the batch instead of trimming it.
No PIN of this length satisfies every selected rule — turn one off or add a digit.- The guard against silently relaxing a rule: a rule set that left zero candidates would stop the batch instead.
Secure random generation is unavailable in this context.- The browser's cryptographic generator was unreachable, and there is no weaker fallback here.
FAQ
What is a prefix like sk_live_ actually for?
Recognition. It shows at a glance which system and environment a value belongs to, and gives scanners a pattern to match, so a leaked key can be spotted and revoked. It adds no secrecy.
Do PIN rules make a PIN harder to guess?
No — they make the pool smaller. Barring equal or consecutive neighbours and obvious favourites removes roughly two thirds of the four-digit space, and the printed bits fall with it. One more digit gains far more than any rule.
Does grouping change the secret?
It changes the value you copy, since the hyphens really are in the string, but not the unpredictable part: the same body characters are drawn either way.
Keyboard shortcuts
- ⌘/Ctrl + Enter
- Issue a new batch; the settings stay, the values are replaced.
- ⌘/Ctrl + S
- Download the batch in the selected format — the file, not the page.
- ⌘/Ctrl + C
- With focus in the tool and nothing highlighted, copies every row; highlight first and only that is taken.
- ⌘/Ctrl + Shift + C
- Copy all rows even while text is selected.
- ? or ⌘/Ctrl + /
- Open the in-tool shortcut help.