How to use the coupon code generator
- Type a Prefix, such as
SAVEorBF26, or leave it empty. - Set the number of Segments (1 to 6) and the Characters per segment (2 to 10).
- Choose a Separator of up to three characters (a dash by default; leave empty for none).
- Pick the Characters: A–Z and 2–9 without look-alikes, A–Z and 0–9, Letters only or Digits only.
- Set How many codes (up to 5,000) and press Generate. Copy the list or download the CSV.
What it does and when to use it
Single-use coupon codes power welcome discounts, referral rewards, influencer campaigns, event tickets and gift vouchers. Each code must be unique, easy to type and hard to guess, because people do try guessing codes from a known pattern. This tool handles all three, and the CSV saves you from copying thousands of codes by hand.
The prefix is not secret. It tells customers and your team which campaign a code belongs to. The random segments carry the security. For codes that count up rather than being random, use the order number generator. For a free-form pattern that mixes letters and digits in fixed places, see the serial number generator. For staff or account passwords, use the bulk password generator.
How it works
Each segment is filled with characters picked by crypto.getRandomValues, with every character in the set equally likely. The prefix and segments are joined with the separator, and repeats are discarded.
- Random part = segments × characters per segment × log2(set size). Only the random characters count, not the prefix.
- Chance one random guess is a valid code = number of possible codes ÷ number of codes issued. A guesser who knows the format still needs that many tries, on average, for each hit.
Worked examples
- The defaults. Prefix SAVE, 2 segments of 4 from the 32-character set give codes like
SAVE-EB2J-YD3ZwithRandom part: 40 bits. For a batch of 3, a guess has a 1 in 366,503,875,925 chance. - One plain block. No prefix, 1 segment of 8: codes like
3CGQTEJN, and for 2 codesChance one random guess is a valid code: 1 in 549,755,813,888. - Too small a format. 1 segment of 2 digits holds only 100 codes, so a request for 200 stops with “Only 100 distinct values fit this pattern — ask for fewer or make it longer.”
Limits and tips
- Rate-limit coupon entry on your checkout. Good codes help, but limits stop automated guessing.
- Store codes in your shop, not in public spreadsheets.
- Letters-only codes can spell words by accident. Glance through the list before you send it out.
Frequently asked questions
Will any two codes in a batch be the same?
How long should coupon codes be?
Why are 0, O, 1 and I missing?
How do I load the codes into my shop?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.