Skip to content

Random PIN Generator for 4, 6 and 8 Digit Codes

Get a list of numeric codes from 3 to 12 digits long, as text so leading zeros survive, for choosing a new PIN or filling a test suite with OTP-style values.

Runs in your browserFree, no sign-upLast reviewed

Settings

Fill in the settings to see your result here.

Your result appears here instantly — nothing is uploaded.

Quick answers

How many 4-digit PIN combinations are there?
10,000, from 0000 to 9999. Each of the four positions can be any of ten digits, so the count is 10 x 10 x 10 x 10. If the first digit cannot be zero there are 9,000.
How many 6-digit codes are possible?
1,000,000, from 000000 to 999999. That is 100 times as many as a 4-digit PIN. Someone allowed three guesses has a 3 in 10,000 chance against a random 4-digit PIN and a 3 in 1,000,000 chance against a random 6-digit one.
Can a PIN start with zero?
Yes. Bank card, phone and SIM PINs can all begin with 0, and about one random code in ten does. Problems only arise when software stores the code as a number and drops the zero, which is why this tool outputs codes as text.
Can I use a generated code as a real OTP?
No. A real one-time passcode is calculated from a secret shared between the service and your authenticator app, or is issued by the service itself by text message. A random number from this page matches neither and will be rejected.
Is a 6-digit PIN safer than a 4-digit PIN?
Yes, when both are random. Six digits give 1,000,000 possibilities against 10,000, so a guesser needs 100 times as many attempts on average. The gain disappears if you choose a date or a pattern such as 123456.

About PIN / OTP Code Generator

This random PIN generator lists 1 to 50 numeric codes, each exactly as many digits as you set between 3 and 12. Codes are text, not numbers, so a result such as 079849 keeps its leading zero when copied or downloaded. A 4-digit PIN has 10,000 possible values and a 6-digit code has 1,000,000, and the Details panel shows that count and the matching entropy for any length. Two switches shape the list: one stops codes starting with 0, the other drops any code with the same digit four or more times in a row. The codes are random digits only. They are not linked to any account, so they will not work as real one-time passcodes.

PIN combinations and entropy by number of digits

Combinations and entropy are the values the tool reports for each length. The last column gives places a code of that length is commonly used.

DigitsCombinationsEntropyWhere this length appears
31,00010 bitsThree-dial luggage and bike locks
410,00013.3 bitsBank cards, SIM cards, older phone passcodes
5100,00016.6 bitsSome door keypads and alarm panels
61,000,00019.9 bitsPhone passcodes, text message and authenticator codes
710,000,00023.3 bitsLonger verification codes
8100,000,00026.6 bitsSIM unlock (PUK) codes, 8-digit authenticator codes
91,000,000,00029.9 bitsReference and booking numbers in test data
1010,000,000,00033.2 bitsLong device passcodes
11100,000,000,00036.5 bitsLong numeric identifiers in test data
121,000,000,000,00039.9 bitsThe longest PIN the card PIN standard ISO 9564 allows

The tool shows combinations as a power of ten, for example 10^6. With Allow a leading zero unticked the true count is nine tenths of the figure shown, because the first digit is limited to 1 to 9.

Sample codes for common settings

Real output from the tool. Every press of Generate produces a different list.

Five 4-digit PINs

Digits 4, How many 5

9348, 5307, 9849, 8962, 4378

Five 6-digit codes, leading zero allowed

Digits 6, How many 5, Allow a leading zero ticked

934853, 079849, 896243, 786776, 403271

The second code starts with 0 and is still six characters long.

Five 6-digit codes, no leading zero

Digits 6, How many 5, Allow a leading zero unticked

934853, 179849, 996243, 786776, 503271

Every code starts with 1 to 9, so each one is also a valid six-digit number.

8-digit codes

Digits 8, How many 5

93485307, 98498962, 43786776, 40327120, 69320680

One 12-digit code

Digits 12

934853079849

The maximum length. Entropy 39.9 bits.

What the two filters do and do not catch

Allow a leading zero controls only the first digit. When it is unticked, the first digit is drawn from 1 to 9 and every other digit from 0 to 9. Untick it when codes pass through a spreadsheet, a numeric database column or a form field of type number, any of which will silently turn 0427 into 427.

Avoid 4+ repeating same digit rejects a code if one digit appears four or more times in a row anywhere in it. For 4-digit PINs that removes exactly ten codes, 0000 through 9999 in steps of 1111, leaving 9,990. For longer codes it also removes values such as 511112. It never has any effect on 3-digit codes.

The filter is narrow on purpose. It does not remove sequences such as 1234 or 4321, repeated pairs such as 1212, keypad lines such as 2580, or anything that looks like a year or a date. If you are choosing a PIN for real use, look through the list and skip any code with an obvious pattern. Duplicates are not removed either: in a list of 50 four-digit codes there is roughly a one in nine chance that two are the same.

PIN, OTP, TOTP: why random digits are not a working passcode

A PIN is a fixed secret you choose once and reuse, checked by a card, phone or lock that limits how many wrong attempts it will accept. That attempt limit is what makes four digits tolerable. Without it, 10,000 possibilities can be tried in moments.

A one-time passcode is valid for a single use. Time-based codes from an authenticator app follow the TOTP standard, RFC 6238: the app and the service share a secret key and each computes the same code from that key and the current 30-second time window, usually six digits. Counter-based codes follow HOTP, RFC 4226. Codes sent by text message are generated and remembered by the service.

In every case the service only accepts the value it expects. A random PIN generator has no shared secret and no connection to any service, so its codes are useful as stand-ins: filling an OTP field in an automated test against a mocked backend, checking that an input accepts exactly six digits and keeps leading zeros, or making screenshots that do not expose a live code.

Choosing a PIN you will actually use

A random code beats one you invent, because people pick the same small set of dates and patterns.

  • Use six digits wherever the device or card allows more than four.
  • Generate a handful and take one from the list instead of pressing Generate until a code looks familiar, which quietly brings your preferences back in.
  • Skip any code that is a birthday, anniversary, house number or part of your phone number.
  • Do not reuse the same PIN for your phone, bank card and door alarm.
  • This tool uses a simple seeded generator started from one of a million seeds, not a cryptographic random source. That is fine for picking a PIN that is protected by an attempt limit and for test data, but do not rely on long codes from it as secrets.

Using PIN / OTP Code Generator

  1. 1

    Enter the number of Digits, from 3 to 12. The default is 6.

  2. 2

    Enter How many codes you want, from 1 to 50.

  3. 3

    Untick Allow a leading zero if the code will be stored or typed as a number, where 0427 would become 427.

  4. 4

    Tick Avoid 4+ repeating same digit to drop codes such as 0000 or 511112.

  5. 5

    Press Generate for a new list, then copy a code or download pins.txt.

Frequently asked questions

Why did I get fewer digits when I pasted a code into a spreadsheet?
The spreadsheet read the code as a number and removed the leading zero. Format the column as text before pasting, or untick Allow a leading zero so no code starts with 0.
What is the most common 4-digit PIN?
Analyses of leaked PIN data consistently find 1234 at the top, followed by codes such as 1111 and 0000 and by years and dates. Those are the first values anyone guessing will try, which is the main reason to let a generator choose instead.
Can I generate a PIN with letters?
No. This tool produces digits 0 to 9 only. For codes that mix letters and digits, use a password or random string generator with the length set to what you need.
Can the same code appear twice in one list?
Yes. Each code is drawn independently and the list is not checked for repeats. With short codes and long lists a repeat is quite possible. If you need unique values, generate a few more than you need and delete any duplicates.
How many codes can I generate at once?
Up to 50 per list. Press Generate again for another 50. The download button saves the current list as pins.txt with one code per line.
Are the generated PINs stored anywhere?
No. They are produced in your browser and are not sent to a server or saved. They disappear when you generate a new list or close the page, apart from anything you copied or downloaded.
What does the Entropy figure mean for a PIN?
It is the number of combinations expressed in bits: each digit adds about 3.32 bits. A 6-digit code has 19.9 bits, meaning about 2 to the power 19.9, or one million, possibilities. Passwords for online accounts are usually expected to have 60 bits or more.

Looking for something else? Browse all generators or see every tool.