Coupon Code Generator

Set a seed, length and count to generate coupon codes.

How it is calculated

Nothing here is random in the usual sense. For code number i the tool starts a small linear congruential generator from crc32(seed + "#" + i), discards its first value, then draws length characters from the 32-character alphabet ABCDEFGHJKLMNPQRSTUVWXYZ23456789, which leaves out 0, 1, I and O so hand-typed codes are not misread. The optional prefix is put in front of each code and is not counted in the length. Because every code depends only on the seed and its position, the same seed, length and count always give the same list, and asking for 4 codes returns the first 3 unchanged plus one more. A code that would repeat one already in the list is drawn again, so a batch has no repeats unless the length is too short to hold it: 1 character gives only 32 different codes. Length is capped at 64 and count at 1000. With 8 characters there are 328, about 1.1 trillion, possible codes, but the generator is predictable and is not meant for security.

Worked example

Seed SUMMER, length 8, count 3 and prefix SAVE-. Code 0 is seeded from crc32("SUMMER#0"), code 1 from crc32("SUMMER#1") and code 2 from crc32("SUMMER#2"). Eight characters are drawn for each and the prefix is added. The output is:
SAVE-MH9NZYE3
SAVE-76RDD6FG
SAVE-ZHEUPTC9
The tool also states 3 codes and 8 chars. Running it again with the same inputs gives exactly these codes, and a count of 4 adds SAVE-E772LTZC at the end.

Try this example →

Common mistakes

  • Treating the codes as secret: anyone who knows or guesses the seed, length and count can regenerate every code, so these are labels for tracking, not protection against guessing.
  • Reusing the same seed for two campaigns; the lists are identical, so give each campaign its own seed.
  • Expecting the length to include the prefix: SAVE- is added on top of the 8 characters, so each full code is 13 characters long.
  • Looking for 0, 1, I or O in a code, or typing them by hand into a validation list; they are never produced, so a code containing them did not come from this tool.
  • Requesting more than 1000 codes or a length above 64 and expecting the full amount; both values are cut to those limits without a warning.

About this calculator

This generator produces a batch of codes deterministically from a text seed — the same seed, length, and count will always reproduce the exact same codes, which is useful for regenerating a lost batch or reconciling codes across systems. Characters are drawn from an unambiguous set that excludes easily confused pairs like 0/O and 1/I/l, so customers typing a code by hand are less likely to mistype it.

E-commerce marketers, growth teams, and loyalty-program managers use it to create batches of promo, discount, or gift codes with an optional shared prefix (e.g. SAVE- or SUMMER-) for campaign tracking, without needing a backend service to generate and store random strings.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Length decides how many codes a batch can hold. Repeats inside a batch are drawn again, so 1,000 codes at length 2 all come out different, but 1 character offers only 32 codes and a larger batch must repeat. Short codes are also easy to hit by guessing, so for a real campaign use at least 6 characters and keep the generated list for validation. Which promotion format are you building, and how many codes do you need?

Popular calculators

All Calculators