By El Ghali Bennis · Published
How to Create Unique Discount Codes (Single-Use, Bulk)
Learn how to create unique discount codes in bulk, stop code sharing, export a CSV and track every redemption. Step-by-step guide.

To create unique discount codes, generate a batch of random, one-per-customer strings, set each to a single redemption, attach the same discount rule, and track usage by code. You can do it by hand for a few dozen codes, or with a bulk generator for thousands. This guide shows both.
One shared code like SAVE20 is easy to set up and easy to lose control of. It lands on coupon sites, gets pasted into browser extensions, and quietly eats your margin. Unique codes fix that. Here's how to build them, which tools to use, and how to avoid the mistakes that cost operators real money.
What Are Unique Discount Codes and When Do You Need Them?
A unique discount code is a one-of-a-kind string, such as WELCOME-K7M2QX, that works for a single customer or a single order. Unlike a generic code, it can't be reused or shared widely, and you can tie each redemption back to the person or campaign it was issued for.
You don't need them for every promotion. A sitewide Black Friday sale works fine with one public code, or better, an automatic discount (we compare the two in automatic discounts vs coupon codes). Unique codes make the most sense in these situations:
- Welcome offers sent by email or popup, where leakage to coupon sites is the main risk. See our welcome popup discount guide for offer sizes and timing.
- Birthday and win-back emails, where each code should belong to one person.
- Influencer discount codes, where you need to know exactly which creator drove which sale.
- Customer service apologies and compensation codes.
- Referral rewards, where every friend gets their own code. Our guide on creating a referral program covers the mechanics.
- Events, packaging inserts and direct mail, where a printed code needs to be traceable.
How to Create Unique Discount Codes Step by Step
The process has six steps: define the offer, choose a code format, generate the batch, set usage limits, distribute the codes, and test one end to end. The order matters, because limits set after distribution can't be enforced on codes already in the wild.
1. Define the offer first
Decide the discount before you generate anything: percentage or fixed amount, minimum order value, eligible products or collections, and an expiry date. Every code in the batch inherits these rules, so a mistake here gets multiplied by your batch size.
A useful rule of thumb: tie the discount to your margin, not to what competitors offer. Here's the math on a 60-dollar order with a 55% gross margin: you earn about 33 dollars before the discount. A 20% code costs 12 dollars and leaves 21 dollars. A 40% code costs 24 dollars and leaves only 9, which may not cover shipping and payment fees.
2. Pick a readable code format
Codes that customers have to type should be short and unambiguous. Use a prefix that names the campaign, a dash, then 6 to 8 random characters. Skip look-alike characters (0/O, 1/I/L), since nothing frustrates a customer faster than a code that "doesn't work" because they typed a zero.
- Campaign prefix: WELCOME, BDAY, VIP, or the creator's name.
- Random suffix: 6-8 characters from a cleaned alphabet (no O, 0, I, 1, L).
- Case-insensitive matching so "welcome-k7m2qx" works the same.
Randomness also protects you from guessing. A 6-character suffix from a 31-character alphabet gives 316, about 887 million possible codes. If you issue 10,000 of them, a random guess hits a live code with a probability of roughly 10,000 in 887 million, or about 1 in 89,000. That's low enough that guessing is impractical for a normal store, especially if you add rate limiting at checkout. For extra margin, use 8 characters, which pushes the pool past 850 billion.
3. Generate the batch
For a handful of codes, create them manually in your admin. For hundreds or thousands, use a bulk discount code generator. Whatever you use, you want it to generate unique coupon codes without collisions, attach the shared rule to each, and give you the full list back.
If you'd rather build the list yourself, here's a Google Sheets formula that produces a code like WELCOME-K7M2QX from a cleaned alphabet. Put it in column A and fill down:
="WELCOME-"&JOIN("",ARRAYFORMULA(MID("ABCDEFGHJKMNPQRSTUVWXYZ23456789",RANDBETWEEN(SEQUENCE(6,1,1,0),31),1)))
That alphabet has 31 characters, which is where the 887 million figure above comes from. Because RANDBETWEEN recalculates on every edit, copy the column and use Paste special, Values only, before you do anything else. Then flag duplicates in column B with =COUNTIF(A:A,A2)>1 and regenerate any that come back TRUE.
Platform notes:
- Shopify: the admin creates one discount code at a time. Bulk creation is available through the discounts bulk-generation feature on the discount page, which creates many codes from a single discount (check your plan and the current Shopify Help Center for limits), or through a third-party app.
- WooCommerce: coupons are a post type, so bulk import needs a plugin or a short script. Set "usage limit per coupon" to 1 and "usage limit per user" to 1 on each.
4. Set usage limits per code
This is the step that makes a code truly unique in practice. Set total uses to 1 for a one time use coupon code, and add a per-customer limit of 1 if the platform supports it. Then add an expiry date. Codes without expiry become permanent liabilities.
5. Distribute one code per recipient
Merge the codes into your email tool so each subscriber gets a different one. Most email platforms accept a CSV with an email column and a code column, then inject the code as a merge field. Never send the same batch file to two campaigns.
6. Test before you send
Place a test order with one code. Confirm the discount applies, the code then fails on a second attempt, and the redemption shows in your reports. Five minutes here beats a customer service queue later.
How to Create Unique Coupon Codes in Bulk
To create coupon codes in bulk, either use your platform's built-in generator, import a CSV of pre-made codes, or script the creation through your payment provider's tools. The right method depends on batch size and how much technical help you have.
| Method | Best for | Batch size | Skill needed |
|---|---|---|---|
| Manual creation in admin | Influencers, VIPs | 1-20 | None |
| Built-in bulk generator | Email campaigns, referrals | 100-10,000 | None |
| Spreadsheet plus CSV import | Custom formats, printed codes | 100-50,000 | Basic |
| Script via payment provider | Automated, on-demand codes | Unlimited | Developer |
Stripe promotion codes in bulk
If your checkout runs on Stripe, the structure helps. Stripe separates a coupon (the discount rule) from a promotion code (the customer-facing string). Per Stripe's coupon documentation, one coupon can back many promotion codes, and each promotion code can have its own redemption limit and expiry. That's exactly the model you want for unique codes: one rule, thousands of single-use strings.
Stripe promotion codes in bulk usually means a short script that loops through a list and creates one promotion code per row with max_redemptions set to 1. A minimal Node.js version looks like this:
for (const code of codes) { await stripe.promotionCodes.create({ coupon: 'WELCOME20', code, max_redemptions: 1, expires_at: expiryTimestamp }); }
Here codes is the array from your spreadsheet and WELCOME20 is the coupon ID you created once. Add a short pause between calls so you stay inside Stripe's API rate limits. A developer can write and test it in under an hour. Without one, a platform with a built-in generator saves you the work.
Using a spreadsheet and CSV
Generate codes with the formula above, check duplicates with a COUNTIF column, save as CSV and import. Keep the original file: it's your master record of which codes exist.
Discount code CSV export
A discount code CSV export matters as much as the import. After the campaign, export the code list with columns for code, status, redemption date, order ID and customer. That file lets you reconcile finance, spot abuse and tell your email team which segments actually converted.
How to Prevent Coupon Code Sharing and Abuse
To prevent coupon code sharing, make each code single-use, tie it to one customer, add a short expiry, and cap total discount exposure. Sharing only hurts when a code can be redeemed many times, so redemption limits do most of the work.
Coupon sites and browser extensions collect public codes and test them at checkout. A unique, single-use code is dead after one order, so it has little value in those databases.
Layer your protections
- Single redemption: a single use coupon code in ecommerce is the baseline defense.
- Customer restriction: lock the code to a specific email or account when possible.
- First-order only: for welcome offers, restrict to customers with no previous orders.
- Minimum order value: stops people burning a 15-dollar code on a 10-dollar item.
- Short expiry: 7 to 30 days for most campaigns.
- Exclude sale items: avoids stacking discounts on already-reduced prices.
Watch for the real abuse patterns
Most abuse isn't hackers. It's the same person creating three accounts to claim three welcome codes. Flag orders that share a shipping address or payment method across multiple first-order codes. If you see more than two in a week, tighten the rule to one per shipping address.
How to Track Coupon Code Redemptions
To track coupon code redemptions, record each code against its order, customer and campaign, then compare redemption rate, revenue per code and margin after discount. Unique codes make this simple because every redemption points to exactly one source.
Track these numbers for every batch:
- Redemption rate: codes used divided by codes sent. As an illustration, 400 redemptions from 2,000 emailed codes is 20%. Benchmarks vary widely by industry and list quality, so compare against your own past batches rather than a generic figure. Personal, timely codes (welcome, birthday) usually beat blast promotions.
- Average order value with code vs. without: tells you whether the discount lifts basket size or just gives away margin.
- Net revenue after discount: the figure that actually matters.
- New vs. returning customers: a welcome code that mostly hits existing customers is leaking.
- Time to redeem: if most redemptions happen in the last two days, expiry is doing real work and you can shorten it.
Influencer discount codes
Influencer discount codes are where unique codes are easiest to justify. Give each creator a code with their name, such as ANNA15, and read the redemption report to see sales, average order value and return rate per person. A flat commission per redemption, or a percentage of net sales, is easy to calculate when attribution is a single field. For example, a 10% commission on 80 redemptions averaging 55 dollars net is 440 dollars, with no guesswork.
One tip: use two codes for big creators. A public code for their audience (ANNA15) and a batch of single-use codes for giveaways. That keeps giveaway winners from leaking codes into the public pool.
Unique promo codes for each customer
Unique promo codes for each customer also unlock lifecycle marketing. Tie a code to an abandoned cart email, and you can see whether that specific email recovered the sale. Our guide to birthday discount emails shows how a personal code outperforms a generic one in a message people actually want to open.
Common Mistakes With Unique Discount Codes
The most common mistakes are forgetting an expiry, setting the wrong usage limit, and letting codes stack with other offers. Each one is easy to prevent with a short checklist before you hit send.
- No expiry date. Codes from a 2025 campaign still working in 2026 are a classic leak.
- Usage limit left unlimited. A "unique" code that can be used 500 times is just a hidden public code.
- Stacking. Check whether your code combines with automatic sales, free shipping thresholds or other codes.
- Discounting too deep. Training customers to wait for a code erodes full-price sales. If you're running sales regularly, a dedicated sale page can contain it.
- Hard-to-type codes. Long random strings with ambiguous characters lose orders. Make codes auto-apply through a link where you can.
- No reconciliation. If nobody compares codes issued to codes redeemed, you'll never know what a campaign cost.
Do unique codes reduce conversion?
Not if you make them easy to use. The friction comes from typing, not from the code being unique. Put the code in a link that applies it automatically, and show it in the cart so customers see the saving.
How many codes should you generate?
Generate slightly more than your recipient list, around 5 to 10% extra, to cover resends and support requests. For a 5,000-person list, that means 5,250 to 5,500 codes. Keep that spare pool in a separate file so it never mixes with live batches.
Build Unique Codes Without the App Stack
On many platforms, bulk codes, redemption reports and abandoned-cart discounts each need a separate paid app. That's how a store ends up with a plugin bill that grows faster than revenue. If you're comparing options, check what's built in before you subscribe, for example against Shopify's published pricing, where many marketing add-ons are billed separately.
Rovela is built for this: discount codes, abandoned cart, loyalty, reviews and marketing automations are included in one flat subscription with no commission on sales, and you set things up by describing them in chat. Stripe checkout is built in, so the coupon and promotion code structure above works out of the box. If you want to see what a full store looks like before you decide, start from the Rovela homepage or check the pricing page.
The short version: fix the offer and its margin first, use a clean code format, cap every code at one use with an expiry, send one per person, and review the redemption export after each campaign. Then your next promotion costs what you planned, not what a coupon site decided.
