Coupon Code Generator
Generate random coupon or discount codes with a custom prefix and format.
Share on Social Media:
Create up to 100 random discount codes at a time in a format you choose. Set an optional prefix (such as SPRING), the number of characters per segment (2–10) and the number of segments (1–4), and you'll get codes like SPRING-H68H-VM2L, ready to copy into Shopify, WooCommerce, Stripe or any platform that accepts a list of unique codes.
Why the codes look the way they do
- No confusing characters. Codes use capital letters and digits but leave out
0,O,1andI, which are easy to misread on receipts and screens. That cuts down "my code doesn't work" support requests. - Cryptographically secure randomness. Each character is picked with PHP's
random_int(), which draws from the operating system's secure random source, so codes don't follow a guessable pattern. - Hyphenated segments. Groups of four are much easier to read aloud and type than one long string.
How long should a code be?
The alphabet has 32 characters, so each extra character multiplies the number of possible codes by 32:
| Format | Random characters | Possible codes |
|---|---|---|
| 1 × 4 | 4 | about 1 million |
| 2 × 4 | 8 | about 1.1 trillion |
| 3 × 4 | 12 | about 1.2 × 1018 |
For a single public promotion, a memorable code like SUMMER20 is fine. Everyone gets the same one. For single-use codes (one per customer, influencer or printed card), use at least 8 random characters, so nobody can guess a valid code by trial and error. The prefix is for your own tracking and adds no security.
Using the codes in your store
- Generate and copy the list.
- Import into your platform as unique codes: Shopify supports bulk-uploading codes to a discount; WooCommerce and Stripe can do the same through bulk tools or their API.
- Set the rules there. The codes do nothing on their own. Expiry date, minimum spend, one use per customer, and which products qualify are all set in your shop's discount settings.
- Use prefixes to track channels:
IG-for Instagram,NEWS-for the newsletter, or one prefix per affiliate. Your sales report then shows which channel brought each sale.
Codes are generated fresh each time and aren't stored by us. We can't check whether a code already exists in your store, but at 8 or more random characters a duplicate is extremely unlikely.