PIN Generator
Generate random 4, 6 or 8-digit PINs. Optional filters leave out obvious patterns like 1234 and 0000, and PINs that read as dates or years.
Generating…
PINs are generated in your browser and are not sent to our server.
01 · Definition
What is a PIN generator?
A PIN generator picks a numeric code at random so that it is not a birthday, a year or a keypad pattern, the codes people choose most often and attackers try first. A 4-digit PIN has 10,000 possible values, a 6-digit PIN 1,000,000 and an 8-digit PIN 100,000,000, so a PIN is only safe behind a limit on wrong attempts.
02 · Overview
How the PIN Generator works
The tool generates numeric PINs of 4, 6 or 8 digits with crypto.getRandomValues, one or up to 100 at a time, with no duplicates in a batch. Two optional filters are on by default. The pattern filter rejects a single repeated digit, runs up or down, repeated blocks, palindromes and a short built-in list of well-known codes. The date filter rejects anything that reads as a day and month, a full date, or a year from 1900 to 2099. PINs are generated in your browser and are not sent to our server.
03 · Guide
What the filters remove
The pattern filter removes one digit repeated (0000, 777777); a run up or down, including runs that wrap past 9 or 0 (1234, 9876, 8901); a shorter block repeated (1212, 123123); palindromes (1221, 123321); and a hand-picked list of 48 well-known codes such as 2580 (the middle column of a phone keypad), 1397 (its corners) and 112233. The list is short and is not a ranking from leaked data.
The date filter removes dates and years. For 4 digits: day-month or month-day (2512, 1225) and years 1900 to 2099. For 6 digits: DDMMYY, MMDDYY or YYMMDD. For 8 digits: DDMMYYYY, MMDDYYYY or YYYYMMDD with a year from 1900 to 2099. 29 February always counts as a date.
Filtering removes a small share of the possible PINs, counted exactly below for 4 and 6 digits. For 8 digits the two filters together remove about 0.2%, measured on a random sample of 2,000,000 PINs. Every PIN that passes is equally likely.
| Length | No filters | Patterns only | Dates only | Both filters |
|---|---|---|---|---|
| 4 digits | 10,000 | 9,775 | 9,236 | 9,040 |
| 6 digits | 1,000,000 | 997,974 | 915,768 | 913,905 |
04 · Use cases
When to use the PIN Generator
- 01
Pick a phone or card PIN that is not a date or a keypad pattern
- 02
Issue a temporary PIN for a device or a door code
- 03
Generate up to 100 distinct PINs for one-time codes or test data
- 04
Get an 8-digit pairing code
05 · Examples
PIN Generator examples
6 digits, both filters on
ex 01809804
It is not a run, a repeat, a palindrome or a date in any of the three 6-digit layouts.
10 PINs, 4 digits, both filters on
ex 023926, 0292, 3075, 0432, 4704, 6522, 3488, 8561, 6317, 5859
Ten distinct PINs drawn from the 9,040 four-digit PINs that pass both filters.
8 digits
ex 0318945316
One of 100,000,000 values. Longer codes suit pairing flows and other places with no lockout.
06 · FAQ
PIN: frequently asked questions
How secure is a 4-digit PIN?
What does the pattern filter leave out?
What counts as a date?
Does filtering make PINs easier to guess?
How many digits should a PIN have?
Can I use these as one-time codes?
Are PINs unique within a batch?
07 · Reference
Specs and further reading
These are the primary sources this tool follows. Where a specification defines the behaviour, we link the specification, not a summary of it.
- SP 800-63B: Digital Identity Guidelines, Authentication and Authenticator Management
NIST. States that activation secrets may be entirely numeric (a PIN), must be at least four characters and should be at least six.
- RFC 6238: TOTP, Time-Based One-Time Password Algorithm
IETF. How authenticator-app codes are derived, and why a random PIN cannot stand in for one.
- Crypto.getRandomValues()
MDN Web Docs. The cryptographically secure source each digit is drawn from.
08 · More
Tools that pair with PIN
Password Generator
Generate strong random passwords or passphrases from the EFF wordlist. Set the length and character types, see the entropy, and make up to 100 at once.
Random Number Generator
Generate random integers or decimals between any two numbers, up to 10,000 at a time. Allow or forbid repeats, and add a seed for a repeatable sequence.
API Key Generator
Generate random API keys and secrets with an optional prefix such as sk_test_. Choose base64url, alphanumeric, base32 or hex, 8 to 96 characters, up to 100 keys.