Pick a length and a character set and the generator draws each character at random from your browser's cryptographic source. A 32-character string of letters and digits has 62 choices per position, so it holds 32 × log₂(62) ≈ 190.5 bits. Serial mode builds codes in blocks, such as INV-7KQ4-M9XD.
About this tool
Developers need throwaway tokens, test IDs, salts and API keys; shops and makers need serial numbers to print on labels or licence keys. This page covers both. In Random string mode you set the length, choose letters and digits, letters only, hexadecimal or digits, and can add 24 punctuation marks. Serial number mode writes codes in hyphen-separated blocks from a 32-character alphabet of capitals and digits that leaves out I, O, 0 and 1, so a code read off a box or typed from a sticker is not misread. Every result lists its entropy in bits, which tells you how many codes exist before repeats become likely. The values are random, not sequential: if your records need serials that count up (0001, 0002…), a spreadsheet fill series is the better fit.
How to use it
Choose a mode
Random string for tokens and keys; Serial number for blocked product or licence codes.
Set the shape
Give a length and character set, or a prefix, the number of blocks and characters per block.
Copy what you need
The first value is the headline; each row of the list below has its own copy button.
Random part = 2 groups × 4 characters = 8 characters from 32 (A–Z and 2–9 without I, O)
Entropy = 8 × log₂(32) = 40 bits
Shorter codes for stock labels: eight random characters give 40 bits, about a trillion possible codes per prefix.
How it is calculated
entropy (bits) = random characters × log₂(alphabet size)
random characters
length in Random mode; blocks × characters per block in Serial mode (the prefix adds none)
alphabet size
62 for letters + digits, 52 letters, 16 hex, 10 digits, plus 24 with special characters; 32 for serials
Every character is an independent uniform draw from the alphabet, using crypto.getRandomValues in the browser. Because 16 = 2⁴ and 32 = 2⁵, a hex character carries exactly 4 bits and a serial character exactly 5 bits. By the birthday bound, repeats become likely only after about 2^(bits ÷ 2) values, so 100-bit serials will not collide in any realistic run.
If serials must run in order for audits or invoices, use a counter rather than random codes.
A barcode needs a symbology such as Code 128; this page makes the text, not the bars.
Common mistakes
Using digits-only strings for secrets: 16 digits hold only 53 bits.
Pasting strings with special characters into URLs or CSV files without escaping them.
Choosing very short serial blocks for large batches, which raises the chance of duplicate codes.
Frequently asked questions
How do I make serial numbers for my products?
Switch to Serial number mode, type a prefix such as your product line code, and set the blocks. Four blocks of five give codes like PRD-ABCDE-FGH23-… with 100 bits of randomness, so even millions of labels will not repeat. Copy the list from the table.
Can I generate a random string with special characters?
Yes. Tick Add special characters and 24 marks such as ! @ # $ % and brackets join the alphabet. With letters and digits that makes 86 choices per position, so 16 characters hold about 102.8 bits.
How do I get a random string of 32 characters?
Set Length to 32. With letters and digits you get about 190.5 bits; with hex you get exactly 128 bits, the same size as a 128-bit key written out in hex.
How do I generate a random string in Python?
Use the secrets module: ''.join(secrets.choice(string.asciiletters + string.digits) for in range(32)), or secrets.token_hex(16) for 32 hex characters. Avoid the random module for anything secret, because its Mersenne Twister output can be predicted.
How do I generate a random string in JavaScript?
In browsers and Node, fill a Uint32Array with crypto.getRandomValues and map each number onto your alphabet; that is what this page does. Math.random is not cryptographically secure and should not create tokens or keys.
How do I generate a random string in Java?
Create a java.security.SecureRandom and pick characters with nextInt(alphabet.length()) in a StringBuilder loop. java.util.Random uses a 48-bit seed and is predictable, so keep it out of anything used as a secret.
Can I make serial numbers in Excel?
For counting serials, type the first number and drag the fill handle, or use =SEQUENCE(100). For random codes, generate them here and paste the copied list into a column; Excel's RANDBETWEEN cannot easily mix letters and digits in blocks.
Is a random string generator safe for passwords?
The draws come from the browser's cryptographic source and nothing is sent anywhere, so the strings are fit for passwords. Aim for 75 bits or more, for example 13 characters of letters and digits.
Cite this tool
Using this tool in an assignment, article or report? Copy a citation, or a link for your website.