Random Code Generator
Get up to 15 random alphanumeric codes of 1–100 characters, letters and digits by default, with a copy button on each one.This random code generator makes short alphanumeric codes of the kind you see on gift cards, coupons, raffle tickets and activation screens. Out of the box it produces five 8-character codes built from uppercase letters, lowercase letters and digits, for example k7Qp2Xa9. You can change the count (1 to 15), the length (1 to 100) and which character classes are allowed, then copy any code with the icon on its card.
Settings
- Number of codes: 1 to 15 per click, all with the same settings.
- Code length: 1 to 100 characters. 8 is the default because it is the most common length for redeemable codes; 6 suits SMS-style verification codes, 16 to 25 is typical for license keys.
- Character classes: lowercase a–z, uppercase A–Z, digits 0–9 and a 29-character symbol set (
!@#$%^&*()_+~`|}{[]:;?><,./-=). Symbols are off by default because most code fields reject them. At least one class always stays checked.
Each character is drawn independently from the combined pool, so a code can repeat a character, and there is no built-in hyphen grouping. If you want a format like ABCD-EFGH-IJKL, generate 12-character codes and insert the dashes, or generate three 4-character codes and join them.
How many codes can you get without a collision?
With letters and digits only, the pool is 62 characters. That gives 626 (about 57 billion) possible 6-character codes and 628 (about 218 trillion) 8-character codes. Two random 8-character codes colliding is a one-in-218-trillion event, so for a batch of 15 you can treat every code as unique. Digits only is a much smaller space: 106 = one million 6-digit codes, which is why real one-time passcodes also expire after a few minutes.
A practical note on readability: with all letters allowed, codes can contain look-alike pairs such as O and 0, l and 1, I and l. If people will be typing the code from a printed card, use uppercase plus digits only and reject batches that contain those characters, or regenerate.
What people use it for
- Placeholder promo and discount codes for a store mockup, an email template or a test order flow.
- Raffle and door-prize tickets. Generate 15 codes, print them, and draw one later with a random picker.
- Sample license keys and activation codes for documentation screenshots, so no real key ends up in a help article.
- Classroom and game codes. Team join codes, escape-room clues or lock combinations that nobody at the table could have predicted.
- Test data. Unique-looking SKUs, tracking numbers or reference IDs when seeding a database.
When to use a different tool
The codes come from JavaScript's Math.random(), which is fine for the uses above but is not a cryptographic source. Do not use these codes as passwords, session tokens or real redemption codes that protect money. For longer free-form strings with the same controls, the Random String Generator is the same engine with a 25-character default. For keys that look like a vendor's format, see the Random API Key Generator; for secret material generated properly, the Encryption Key Generator. If the code needs to be scanned rather than typed, turn it into an image with the Random QR Code Generator. The full set is under all developer & test data tools.
Frequently asked questions
- How do I generate a code with numbers only?
Uncheck Lowercase letters and Uppercase letters and leave Digits ticked. Set the length to 4 or 6 for PIN-style codes. Leading zeros are possible.
- Can I generate codes in a specific format like XXXX-XXXX?
Not directly; there is no separator option. Generate 8-character codes and add the hyphen yourself, or generate two 4-character codes per final code.
- Are the codes unique?
Within a batch, effectively yes for any length of 6 or more with letters enabled, because the number of possible codes is in the billions. Very short digit-only codes can repeat.
- Can I use these as real gift card or coupon codes?
Only if your system stores and validates them; a code is just a string until it is registered somewhere. The generator itself keeps no record of what it produced.
- What is the longest code it can make?
100 characters, and up to 15 of them per click.



