Random PIN and OTP Code Generator
100% PrivateSecurity & Privacy UtilitiesGenerate batches of fixed-length numeric PIN and one-time codes with secure randomness.
Runs entirely in your browser. Your input is not uploaded to Ovatly or anywhere else.
Codes are drawn from your browser's cryptographic random source, and leading zeros are kept, so a 4-digit code can be 0042. These are random codes for testing and vouchers, not a replacement for a real one-time-password system, which derives codes from a shared secret and the current time.
- 1Choose the digits per code: 4 for a classic PIN, 6 for an OTP-style code, more for vouchers.
- 2Set how many codes you need, up to 500.
- 3Press Generate codes.
- 4Copy the list or download it as a text file, one code per line.
A run of five 6-digit codes produced: 492715, 004730, 835137, 959162, 298439. Note 004730: the leading zeros are real digits of the code and are preserved in the copy and download. Your run will differ; that is the point of a random generator.
- Codes are generated with crypto.getRandomValues and rejection sampling, so every digit is uniformly distributed with no modulo bias.
- Duplicates are possible by chance in large batches (with 500 four-digit codes, repeats are likely, since only 10,000 exist). If you need uniqueness, deduplicate after generating.
- These are standalone random codes, not time-based OTPs: a real OTP system derives codes from a shared secret and the clock (TOTP), which this tool does not do.
- Nothing is stored; the list disappears when you leave the page unless you download it.
As pre-generated single-use codes (like backup or voucher codes), they can work if you store them hashed and expire them properly. They are not a substitute for TOTP or SMS/app OTP flows.
About this tool
The Random PIN and OTP Code Generator produces batches of fixed-length numeric codes with your browser's cryptographic random source, keeping leading zeros so codes like 0042 stay four digits. It is meant for test data, voucher batches, classroom codes and placeholder OTPs while you build the real thing.
Related tools
Part of Ovatly's free tools in Security & Privacy Utilities.