Discount Code Generator: Unique Codes in Bulk
Choose a prefix, how many random characters follow it and how many codes you need. The generator draws every code from your browser's cryptographic random source, skips characters people misread such as 0 and O, guarantees no repeats in the batch and shows how many codes are possible, then exports a CSV you can import or paste.
| Platform | Case | Limits worth knowing | Usage controls |
|---|---|---|---|
| Shopify | Not stated on the help page | Up to 20,000,000 unique codes per store in total; avoid special characters | Set in the discount settings |
| WooCommerce | Not case-sensitive (SAVE10 equals save10) | Optional expiry date | Usage limit per coupon and per user; individual use only |
| Stripe promotion codes | Case-insensitive | Unique across active promotion codes; up to 20 discounts on a subscription or invoice | max_redemptions and expires_at |
Updated
A single public code like WELCOME10 is fine for a newsletter. When each customer, influencer or printed flyer should get its own code, you need hundreds of codes that cannot be guessed and do not collide. Typing them by hand invites mistakes; spreadsheet RAND formulas repeat and are not built for secrecy. This page does it properly in a second.
Generate codes
Prefix (optional): FLYER
Join prefix with a dash
Random characters: 8
How many codes (max 5,000): 20
Characters: Letters and digits, Letters only, Digits only
Remove look-alikes (0, 1, I, L, O)
852,891,037,441 possible random parts with these settings.
Codes are made in your browser and never sent anywhere.
Make codes in your own code
The same approach for a script or a back-office page: draw bytes from the cryptographic generator and throw away values that would bias the result.
Unbiased random code in JavaScript
Runs as written in any current browser console. Bytes at or above the limit are skipped so every character is equally likely.
const SAFE = "23456789ABCDEFGHJKMNPQRSTUVWXYZ"; // 31 characters
function randomCode(length = 8) {
const limit = 256 - (256 % SAFE.length);
const byte = new Uint8Array(1);
let code = "";
while (code.length < length) {
crypto.getRandomValues(byte);
if (byte[0] < limit) code += SAFE[byte[0] % SAFE.length];
}
return code;
}
console.log("VIP-" + randomCode()); // e.g. VIP-7KQ4M9TX
One shared code or many unique ones
A shared code is easy to promote but spreads beyond the people you meant it for, often onto coupon sites. Unique single-use codes keep the offer with the person who received it and tell you exactly which channel brought each sale.
A middle path is one shared code per channel: a different prefix for the newsletter, each influencer and each print run, so your reports still split by source.
Length and guessing
The number of possible codes is the size of the character set raised to the length. Going from 6 to 8 random characters multiplies that space by about a thousand with the safe set, which is why short codes are fine for a shared public offer but not for valuable one-off ones.
Guessing is also limited by your store, which can cap uses, expire codes and require a minimum spend. Combine a decent length with those limits rather than relying on either alone.
How it works
- Type an optional prefix that tells you where the code came from, such as FLYER or VIP.
- Choose the random length and the character set. Leave Remove look-alikes on for codes people will type.
- Set how many codes you need, up to 5,000 per batch.
- Press Generate codes. Check the list and the possible-codes figure.
- Download the CSV or copy the list, then import it into your store's discount settings.
Tips
- Use at least 8 random characters for single-use codes that carry real value, so they cannot be guessed by trying combinations.
- Keep the prefix meaningful but short. It is for your reports, not for security.
- Since codes are matched without regard to case on several platforms, generate them in one case to avoid confusing customers.
- Set an expiry date and a usage limit in your store for every batch, so a leaked list cannot be used forever.
- Work out the discount before you create codes; our percent off calculator shows the sale price and the saving.
Frequently asked questions
How random are these codes?
Each character comes from crypto.getRandomValues, the browser's cryptographically strong random generator, and characters are picked without bias toward any letter. With 8 characters from the 31-character safe set there are about 853 billion possible codes.
Can two codes in a batch be the same?
No. The generator keeps drawing until it has the number of unique codes you asked for. If you ask for more codes than the settings allow, it tells you to raise the length instead.
Are discount codes case-sensitive?
It depends on the platform. WooCommerce says its coupon codes are not case-sensitive, and Stripe says the promotion code string is case-insensitive. Check your own platform's help page if case matters to you.
How do I get these codes into Shopify, WooCommerce or Stripe?
Each platform has its own import or bulk-create screen, and some only create codes through their API. This page gives you the list; follow your platform's instructions to attach the codes to a discount. We do not connect to any store.
Are my codes stored by this page?
No. They exist only in this tab until you download or copy them, which also means nobody else can see your list.
Related: Profit margin calculator, Gift certificate maker, Shopify pricing guide, SKU generator.
Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.
More in Free Tools
- Free DNS Lookup
- DNS Propagation Checker
- Domain Age Checker
- Free Domain Name Generator
- Downtime Cost Calculator | Free Tool
- Early Payment Discount Calculator
- eBay Fee Calculator
- SPF, DKIM, DMARC and MX Checker
Product
Who It's For
- For Agencies
- For Freelancers
- For Hosting Providers
- For SaaS Platforms
- For Startups
- For Financial Services
- For Healthcare
Features
Resources
- Blog
- Help Center
- Free Business Tools
- Free UI Components
- Website Templates
- Template Collections
- Website Examples
- Guides
- Comparisons
- Alternatives
- Best Lists
- Reviews
- Pricing Guides
- Use Cases
- Glossary & Guides
- Integrations
- Developers
- Benchmark
- Windows App