Random PIN generator
Generate random 4 to 12 digit PINs in bulk, with an optional filter that rejects birthdays, years, repeats, runs and the codes thieves try first.
- Runs in your browser
- Nothing you enter is sent
- Free, no account
Your PIN is generated here and stays here. The digits come from your browser’s crypto.getRandomValues, not from Math.random, and are never sent to a server, written to storage or added to your browser history.
Guessable in seconds by anyone with a copy of the password hash.
Four digits is the banking standard. Six is the phone standard. Anything you type on a touchscreen leaves smudges, so more digits genuinely help.
Rejects the code and draws again if it matches any of the rules below. Because rejected codes are simply redrawn, the survivors stay uniformly distributed.
Up to 200 at once.
| Pattern | Why it is rejected |
|---|---|
| One digit repeated | 0000, 1111, 8888 — ten possibilities in total, and always tried first. |
| Straight run | 1234, 4321, 6789 — a keypad walk in either direction. |
| Repeated block | 1212, 123123, 112112 — the attacker guesses the block, then the length. |
| Palindrome | 1221, 45654 — memorable, and a tenth of the search space of a random PIN. |
| Known common PIN | The thirty four-digit codes that dominate every leaked PIN dataset. |
| Looks like a year | Birth and graduation years cover 1900–2099: 200 of the 10 000 four-digit codes. |
| Looks like a day and month | DDMM and MMDD birthdays. Roughly 700 codes, and the first thing a thief tries. |
| Attack | Assumed rate | Average time to crack |
|---|---|---|
| Online, rate limited | 100 guesses per hour — a login form that locks out after repeated failures | 2 days |
| Online, no throttling | 1 000 guesses per second — credential stuffing against an unprotected API | 5 seconds |
| Offline, slow hash | 20 000 guesses per second — bcrypt or PBKDF2 on a rented GPU box | under a second |
| Offline, fast hash | 100 billion guesses per second — unsalted SHA-1/MD5 on an eight-GPU rig | instantly |
How to generate a secure PIN
- Choose the length. Four digits for a bank card, six for a phone, more for anything where an attacker could try codes without a lockout.
- Leave the weak-pattern filter on. It removes the codes that appear at the top of every leaked PIN dataset, along with runs, repeats, palindromes, years and dates.
- Generate, and read the numbers. The panel shows how many codes remain after filtering and what that is worth in bits, so the cost of the filter is visible rather than assumed.
- Memorise it before you leave the page. Nothing is stored anywhere. Say it out loud a few times, or split it into two pairs and rehearse those.
How much protection does a PIN give?
Very little on its own, and that is fine — a PIN is never meant to withstand an unlimited attack. It works because something else limits the attempts: three tries before a cash machine swallows the card, ten before a phone wipes itself, a lockout timer that doubles after each failure. Remove that limit and even a twelve-digit PIN is weak.
| Digits | Possible codes | Entropy | 3 guesses allowed | Offline, 100 G/s |
|---|---|---|---|---|
| 4 | 10,000 | 13.3 bits | 1 chance in 3,333 | instantly |
| 5 | 100,000 | 16.6 bits | 1 chance in 33,333 | instantly |
| 6 | 1,000,000 | 19.9 bits | 1 chance in 333,333 | instantly |
| 8 | 100,000,000 | 26.6 bits | 1 chance in 33 million | instantly |
| 10 | 10 billion | 33.2 bits | 1 chance in 3.3 billion | under a second |
| 12 | 1 trillion | 39.9 bits | 1 chance in 333 billion | 5 seconds |
The last column is why a PIN should never be the only thing protecting data that can be copied off a device. If the storage is encrypted with a key derived from the PIN alone, and an attacker can take an image of the disk, they are not limited to three guesses any more.
The patterns this tool refuses to produce
Studies of leaked PIN datasets keep finding the same thing: roughly a quarter of all four-digit
PINs come from a list of about twenty codes, and 1234 alone accounts for around
one in ten. Human choice concentrates in a tiny corner of a small space. The filter removes
that corner.
| Rejected pattern | Examples | Why |
|---|---|---|
| One digit repeated | 0000, 1111, 8888 | Ten codes in total, and always tried first. |
| Straight run | 1234, 4321, 6789 | A keypad walk in either direction — the second thing tried. |
| Repeated block | 1212, 123123 | The attacker guesses the block, then the length. |
| Palindrome | 1221, 45654 | Memorable, and only a tenth of the space of a random code. |
| Year | 1987, 2024 | 1900 to 2099 is 200 of the 10,000 four-digit codes. |
| Day and month | 0312, 1203 | About 700 codes, and a stolen wallet usually contains the date of birth. |
| Six and eight-digit dates | 031287, 03121987 | How most people pick longer codes; an eight-digit birthday has under 40,000 options. |
Does filtering make the PIN less random?
No — and this is worth understanding, because the naive implementation of a filter does. If you generated a code and then "fixed" it by changing digits until it passed, the result would be biased. Instead, a rejected code is discarded and a fresh one drawn. Every code that survives is exactly as likely as every other, so the distribution stays uniform over a slightly smaller set. The entropy figure in the tool is computed from the size of that set, exactly for short PINs and by sampling for long ones.
Practical advice
- Never use a date connected to you. Not your birthday, not your child's, not your wedding anniversary. A thief who has your wallet has your ID.
- Do not reuse a card PIN as a phone passcode. Someone who shoulder-surfs one gets the other.
- Mind the smudges. A greasy touchscreen shows which digits are involved, which cuts a four-digit search from 10,000 to a few dozen. Longer codes and the occasional deliberate wrong swipe both help.
- Prefer six digits to four wherever the device offers it, and a full alphanumeric passcode on anything holding your email — because your email is the reset channel for everything else.
- If you must write it down, disguise it. A PIN hidden as a phone number in your contacts is far safer than the same PIN memorised badly and therefore replaced with 1234.
Questions
Which PINs does the weak-pattern filter reject?
Codes made of one repeated digit, straight runs like 1234 or 9876, repeated blocks like 1212, palindromes, the thirty codes that dominate every leaked PIN dataset, and anything that reads as a year or a date at the relevant length. The page lists the exact rules that apply to the length you picked, along with how much of the search space they remove.
Does filtering weak PINs make the result less random?
No. Rejected codes are simply drawn again, so the surviving codes remain uniformly distributed — every allowed PIN is exactly as likely as every other. The only effect is a smaller search space, which the entropy figure on the page accounts for exactly.
Is a four-digit PIN enough?
Only because something limits the attempts: three tries at a cash machine, ten before a phone wipes. Four digits is 10,000 possibilities, which an offline attacker exhausts instantly. If the PIN protects something that could be attacked offline, use six digits at minimum, and prefer a password.
Why avoid dates when they are so easy to remember?
Because that is exactly why thieves try them first. A stolen wallet usually contains a date of birth, and DDMM plus MMDD covers only about 700 of the 10,000 four-digit codes. A memorable PIN that a stranger holding your ID can guess is not memorable, it is published.