PIN Generator

A random PIN that is never 1234.

Your PINNever leaves this page

3 tries then locked
10 tries then wiped
Unlimited tries
More options

This PIN generator produces a random numeric PIN in your browser, and refuses to hand you one of the few hundred that every attacker tries first. Nothing is sent to a server.

What is a PIN generator?

A PIN generator produces a numeric code — usually four, six or eight digits — using a random source rather than your memory. The point is not that the digits are special. It is that nobody, including you, chose them.

A PIN is not a short password

Passwords get longer every year. PINs have stayed at four digits for fifty years, and that is not an oversight.

A PIN is typed on a keypad, often in public, often in a hurry, sometimes by someone who will never manage twelve characters. Short is the requirement, so a PIN generator cannot buy safety with length the way a password generator does. It has to come from somewhere else.

Why the one you would have picked is worse

People are reliably bad at this, and the numbers are not close. It is the single strongest argument for using a PIN generator at all.

In an analysis of 29 million four-digit PINs from Have I Been Pwned, 1234 accounts for 9.0 percent of them, 0000 for 1.6 percent and 1111 for 1.1 percent. 2580 sits inside the forty most common because it draws a line down a phone keypad, though no share is published for it. If PINs were spread evenly across all ten thousand possibilities each would account for 0.01 percent, a bar nine hundred times shorter than the one for 1234.

Across 29 million PINs found in breach data, 1234 alone accounts for 9.0% of them. An even spread would give every PIN 0.01%.ABC News analysis of Have I Been Pwned data, Julian Fell and Teresa Tan, January 2025.

Around twenty of the fifty most common PINs are years beginning 19 or 20. Another,2580, is popular for no reason except that it draws a line straight down a phone keypad. None of these would ever come out of a PIN generator.

One guess beats nine hundred

An attacker who tries only 1234 succeeds against nearly one person in eleven. That single guess is worth about nine hundred guesses spent anywhere else, which is the entire argument for using a PIN generator instead of thinking of a number.

How safe is a 4-digit PIN?

"10,000 combinations" is the wrong number

Every PIN generator quotes it, and on its own it says nothing. Ten thousand is a large number to a person entering digits at a cashpoint and a trivial one to a computer.

What decides the answer is how many wrong entries the thing you are unlocking will tolerate before it stops accepting them.

One randomly generated four-digit PIN, drawn from the 9,748 that survive the predictability filter, faces three very different situations. Behind a three-attempt lockout an attacker has a one in 3,249 chance, or 0.03 percent. Behind a ten-attempt limit the chance is one in 975, or 0.10 percent. With unlimited offline attempts at ten thousand guesses per second the PIN falls in under a second. The digits are identical in all three cases; only the lock differs.

The same generated 4-digit PIN is either perfectly adequate or worthless, depending entirely on what counts the wrong answers.Odds computed from the 9,748 PINs left after filtering; the offline figure assumes a conservative 10,000 guesses per second.

Which length to choose

Four digits is fine behind a lockout, which covers bank cards and most door locks. The PIN generator offers it as a preset for exactly that reason — it is the default on those systems because it has to be, not because it is generous.

Six digits multiplies the attacker's work by a hundred for two extra keypresses, which is why this PIN generator starts there. Eight suits safes and alarm panels, where you enter the code rarely and nobody is queuing behind you.

When no PIN is the right answer

If what you are protecting can be copied and attacked at leisure — a disk image, an encrypted archive, a backup file — then attempts are unlimited and every PIN length people will tolerate falls quickly.

That situation calls for a generated password or a passphrase. No PIN generator can help, and a longer PIN only delays the answer.

The PINs this generator will not give you

The five rules

With the filter on, this PIN generator discards and redraws whenever the result matches any of these:

  • Every digit the same — 0000, 7777
  • A run of consecutive digits, forwards or backwards — 1234, 9876
  • A two-digit pattern repeated — 1212, 8383
  • A year from 1900 to 2029 — 1986, 2004
  • A straight line on the keypad — 2580, 1470, 1590

For four digits that removes 252 of the 10,000, leaving 9,748. For six digits it removes 110 of a million, which is why the filter matters most at the shortest lengths.

Two kinds of weak, and only one a tool can fix

This is the distinction that decides what the filter should and should not do, and it is worth being precise about.

1234 is weak no matter who chose it, because it sits at the top of a list every attacker already has. A PIN generator can and should refuse to produce it.

Your birthday is weak for a completely different reason: not the digits, but the fact that somebody can look them up. Drawn at random, those same four digits carry no such problem.

So dates are not filtered

Excluding every MMDD combination would shrink the pool by several hundred to guard against a weakness that does not exist once the digits are random. The filter stays on the first kind of weak only.

The honest cost of filtering

Removing outcomes from a random draw makes it slightly less uniform, and it would be dishonest for a PIN generator to skip past that.

Against someone who knows you used this exact filter, three guesses go from a 0.0300% chance to 0.0308%. Against someone guessing 1234, 0000 and 1111 — which is what actually happens — the chance goes from 0.03% to zero. The entropy cost is 0.037 bits out of 13.29.

Using the PIN somewhere real

Do not reuse one

A PIN is guarded by an attempt counter rather than by encryption, so it survives on obscurity in a way a password does not. One shoulder-surfed entry at a checkout compromises every lock that shares it.

Running the PIN generator again costs nothing, which is the entire reason not to economise here.

They are four to six digits. Generate one each.

Memorising it

A random six-digit PIN is roughly as hard to learn as a phone number, and the same trick works: read it in two groups of three, type it a dozen times on the first day.

Do not write it on the card. Storing it in a password manager is fine, as long as that is not the thing the PIN unlocks — a PIN generator cannot save you from that particular circle.

Excluding digits, and batches

Keypads wear out unevenly, and a worn key advertises itself. If one digit on a shared lock is visibly polished, exclude it here and the PIN generator will avoid it entirely.

The quantity setting produces a list, which suits handing out door codes or seeding test data. Each is drawn independently, so a long list may repeat — that is what independent draws look like.

Frequently asked questions

Is my PIN sent to a server?

No. It is generated by JavaScript already loaded in this page, using your browser’s cryptographic random source. Worth asking, because it is not universal: one of the better-known PIN generators states plainly that it uses Python’s secrets module on the server side, which means the PIN travels over a network before you see it.

Is a 4-digit PIN enough?

It depends entirely on what happens after a wrong entry. Behind a three-attempt lockout, a random 4-digit PIN gives an attacker about a 0.03% chance, which is fine. Where attempts are unlimited, all 10,000 can be tried in under a second and no PIN of that length helps.

Why does this PIN generator default to 6 digits?

Because 6 digits costs two extra keypresses and multiplies an attacker’s work by a hundred. Four is offered as a preset because cards and older locks require it. Defaulting to 4 because it is the more common search would be letting search volume set security advice.

Could this tool ever give me 1234?

Not while "avoid predictable PINs" is on. It rejects runs, repeated digits, repeated two-digit patterns, years from 1900 to 2029 and straight lines on the keypad — 252 of the 10,000 four-digit PINs in total. Turn the switch off and all 10,000 are back in play.

Does filtering those out make the result less random?

Very slightly, and the honest numbers are these. Against an attacker who knows you used this filter, three guesses go from a 0.0300% chance to 0.0308%, because the pool is smaller. Against a real attacker guessing 1234, 0000 and 1111 first, the chance goes from 0.03% to zero. The entropy cost is 0.037 bits.

Can I use the same PIN for my phone and my bank card?

Better not to. A PIN is usually protected by an attempt limit rather than by encryption, so reusing one means a single shoulder-surfed entry unlocks both. Generate one for each; they are four to six digits, not a passphrase.

Is a birthday a bad PIN?

Chosen as a birthday, yes, because someone who knows you can look it up. Drawn at random, the same four digits are fine — the weakness was never the digits, it was that they were guessable from you. That is why this generator filters 1234 but not 0312.

Does it work offline?

Yes. Once the page has loaded you can disconnect from the internet and it keeps generating, which is also the simplest way to confirm nothing is being sent anywhere.

More free generators

Every tool here runs locally in your browser, with no account and no limits, on the same terms as this PIN generator.

Methodology

Last updated

How the digits are drawn

Each digit comes from crypto.getRandomValues() through rejection sampling, so every digit is equally likely and Math.random() is never used. With repeats disallowed, the ten digits are shuffled with a Fisher-Yates pass from the same source and the first few taken.

How the filter is applied

By rejection, not repair. A PIN matching any rule is thrown away and another drawn, which keeps every surviving PIN exactly as likely as every other. Nudging a digit to break the pattern would bias the output in a way that is hard to see and harder to reason about.

Where the counts come from

possible = pool^length − (PINs matching any rule)

The rules overlap — 2020 is both a year and a repeated pair — so for spaces up to a million the excluded PINs are enumerated rather than added up, which counts each one once. The 252 and 9,748 figures on this page come from that enumeration and are asserted in the unit tests.

What is not modelled

Smudges on a screen, cameras above a keypad, and someone watching you type. Those defeat any PIN regardless of how it was drawn, and no PIN generator can help with them. The offline figure assumes 10,000 guesses per second, which is conservative for modern hardware.

Privacy

Generated PINs are never transmitted, written to storage, placed in the URL or attached to an analytics event. Load the page, disconnect from the internet, and it keeps working.