Skip to content

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…

Generating a PIN in your browser…

PINs are generated in your browser and are not sent to our server.

Length
How many
Leave out

Obvious patterns: one digit repeated (0000), runs up or down (1234, 9876), repeated blocks (1212), palindromes (1221) and a short list of well-known codes such as 2580. Dates and years: anything that reads as a day and month, a full date, or a year from 1900 to 2099.

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.

LengthNo filtersPatterns onlyDates onlyBoth filters
4 digits10,0009,7759,2369,040
6 digits1,000,000997,974915,768913,905
PINs remaining after filtering

04 · Use cases

When to use the PIN Generator

  1. 01

    Pick a phone or card PIN that is not a date or a keypad pattern

  2. 02

    Issue a temporary PIN for a device or a door code

  3. 03

    Generate up to 100 distinct PINs for one-time codes or test data

  4. 04

    Get an 8-digit pairing code

05 · Examples

PIN Generator examples

6 digits, both filters on

ex 01

809804

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 02

3926, 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 03

18945316

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?

There are only 10,000 of them, so a 4-digit PIN is safe only where wrong guesses are limited, as on a bank card or a SIM. With three attempts allowed, a random 4-digit PIN is guessed 3 times in 10,000. A PIN someone chose is weaker than that because people favour dates and patterns, which is the reason to generate one.

What does the pattern filter leave out?

A single digit repeated (0000), runs up or down including wrap-around (1234, 9876, 8901), a block repeated (1212, 123123), palindromes (1221) and a built-in list of 48 well-known codes such as 2580 and 112233. It removes 225 of the 10,000 four-digit PINs.

What counts as a date?

For 4 digits, anything that is a valid day-month or month-day pair, or a year from 1900 to 2099. For 6 and 8 digits, a valid date in day-month-year, month-day-year or year-month-day order. With the date filter on, 9,236 of the 10,000 four-digit PINs remain. Turn it off if you want every PIN to be possible.

Does filtering make PINs easier to guess?

It shrinks the pool slightly: with both filters on, 9,040 of 10,000 four-digit PINs and 913,905 of 1,000,000 six-digit PINs remain. An attacker who knows the filters has 9 to 10% fewer candidates. In exchange the PIN is never one of the dates and patterns that guessing attacks start with.

How many digits should a PIN have?

Use 6 or more where you can. NIST SP 800-63B requires activation secrets such as PINs to be at least 4 characters and says they should be at least 6. Four digits is acceptable only with a strict limit on failed attempts.

Can I use these as one-time codes?

Yes, if your system stores each code, expires it after a few minutes and accepts it once. They are not a substitute for authenticator-app codes, which are derived from a shared secret and the current time (TOTP, RFC 6238).

Are PINs unique within a batch?

Yes. A batch never contains the same PIN twice. The largest batch is 100, and at least 9,040 PINs pass the filters at every length, so a batch can always be filled. If a request ever could not be met, the tool shows a message instead of repeating a PIN.

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.

08 · More

Tools that pair with PIN

Last updated .