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.

How three popular platforms treat discount codes (as of October 2026)
PlatformCaseLimits worth knowingUsage controls
ShopifyNot stated on the help pageUp to 20,000,000 unique codes per store in total; avoid special charactersSet in the discount settings
WooCommerceNot case-sensitive (SAVE10 equals save10)Optional expiry dateUsage limit per coupon and per user; individual use only
Stripe promotion codesCase-insensitiveUnique across active promotion codes; up to 20 discounts on a subscription or invoicemax_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

  1. Type an optional prefix that tells you where the code came from, such as FLYER or VIP.
  2. Choose the random length and the character set. Leave Remove look-alikes on for codes people will type.
  3. Set how many codes you need, up to 5,000 per batch.
  4. Press Generate codes. Check the list and the possible-codes figure.
  5. Download the CSV or copy the list, then import it into your store's discount settings.

Tips

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: Percent off 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

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap