Coupon Code Generator
Bulk, human-typeable promo codes — uniqueness checked in-browser
Configuration
100 codes × 8 random charsGenerated codes
No batch generatedConfigure the batch and press Generate
Nothing is stored — export is the persistence.
Examples
Summer campaign
500 codes · 8 chars · prefix SAVE- · no ambiguous charactersSAVE-K7M2Q9XR, SAVE-T3W8P4CZ, …A branded batch with typeable bodies and guaranteed in-batch uniqueness.
Printed voucher
50 codes · 8 chars · segment size 4 · separator -H7K2-P9XRGrouping improves readability on physical materials; separators are literal.
Tiny code space
10,000 codes · 4 digits · digits-only alphabetGeneration blocked: 10,000 requested but only 10,000 four-digit combinations existThe space check stops impossible batches before any codes are issued.
About this tool
The Coupon Code Generator creates batches of customer-facing promo codes in your browser. It uses crypto.getRandomValues with rejection sampling, so every character is drawn uniformly and no modulo bias creeps into the code space. A Set tracks the whole batch and regenerates on collision, with a bounded retry loop that reports a clear error instead of silently issuing duplicates.
Codes are optimized for humans typing them from a screen, a printed flyer, or a phone call. The default alphabet has 31 characters — uppercase A–Z without I, L and O, plus digits 2–9 — so the most common confusions (0/O, 1/l/I) cannot occur. The tool also computes the exact code space as alphabet^length with BigInt, warns near saturation, and refuses requests that cannot fit.
Prefixes, suffixes and grouped segments such as XXXX-XXXX are literal decorations around the random body; they are never counted in the code-space math. Exports come as a codes-only CSV (matching Shopify's bulk discount-code import), a generic five-column CSV, or JSON-style plain lists via Copy. A BOM is included by default so Excel opens the file with the characters intact.
Coupon codes are identifiers, not secrets. Never use them as passwords or API keys; use the API Key Generator or Password Generator for that job.
What this tool does not do
- Codes are not security tokens; they are meant to be typed by customers and shared.
- Store import formats change — the bundled Shopify and generic presets are starting points, not a guarantee for every store version.
- The default alphabet excludes 0/O and 1/l/I but 5/S and 8/B remain visually or phonetically similar.
- Generated batches are not persisted; export or copy them before navigating away.
How to use this tool
Choose the batch shape
Set count (1–10,000), random body length (4–24), prefix/suffix, alphabet and optional segment grouping.
Read the space math
The header shows how many combinations exist and warns when the requested count saturates or heavily samples that space.
Generate
Press Generate codes (or Mod+Enter). Collisions are regenerated automatically and the list is rendered in a scrollable panel.
Export
Pick codes-only, Shopify or generic CSV format, toggle the Excel BOM, then Copy or download the CSV.
Use cases
E-commerce campaigns
Issue hundreds of branded discount codes for a sale without manually checking for duplicates.
Print and physical media
Generate segmented, uppercase codes that are easy to transcribe from flyers or packaging.
Support one-offs
Create small batches of apology or compensation codes with a recognizable support prefix.
Output formats
| Format | Contents |
|---|---|
| Codes only | Single `code` column — Shopify bulk discount-code import style. |
| Generic CSV | code, discount_type, discount_value, usage_limit, expires_at. |
| Plain list | One code per line via Copy. |
| Segmented | Body split into equal groups joined by a separator; the last group may be shorter. |
| Saturation note | Exact combinations and collision warnings shown before export. |
Length counts only the random body. Prefix, suffix, separators and the BOM are not part of the code space.
Common mistakes
Mistake:Using an alphabet that is too small for the requested count.
Fix:Read the code-space line: increase the random body length or the alphabet size before generating. The tool blocks impossible requests.
Mistake:Counting prefix or separators as entropy.
Fix:Only the random body contributes to the code space. A 4-character body with a long prefix is still only alphabet^4 combinations.
Mistake:Treating coupon codes as secrets.
Fix:Coupon codes are identifiers that get printed and shared. Use a password or API key generator for anything that must be confidential.
Frequently asked questions
Why exclude 0/O and 1/l/I from coupon codes?
Customers misread them constantly, especially in fonts where zero and capital O look identical. The default alphabet removes those five characters, leaving 31 unambiguous characters (A–H, J–N, P–Z and 2–9). Two look-alike pairs remain — 5/S and 8/B — because removing them would shrink the code space further; read codes aloud carefully when that matters.
How do I import codes into Shopify?
Choose the Codes only CSV format and export. Shopify's bulk discount-code import expects a single column of codes, so this preset emits exactly one `code` header and one code per row. The BOM is on by default so Excel does not garble the file if you inspect it first. Other stores may want the five-column generic preset — check your platform's current import documentation.
How many unique codes are possible?
The tool computes alphabet^length exactly with BigInt and displays it above the results. With the default 31-character alphabet and an 8-character body that is 852,891,037,441 combinations — far more than any realistic campaign. Prefix, suffix and segment separators are fixed decorations and do not add combinations.
Should coupon codes be uppercase?
For print and phone support, yes: uppercase plus an ambiguity-reduced alphabet is easiest to transcribe. The default is uppercase. If your storefront compares codes case-sensitively, make sure the exported uppercase codes match what customers type; the generator applies uppercase to the whole emitted code, including prefix and suffix.
How long should a coupon code be?
Eight random characters is a good default: with 31 choices per character the space is about 8.5×10^11, and the code is short enough to type. Go to 10–12 characters for very large campaigns or if you allow a bigger alphabet. Avoid 4-character bodies for bulk batches — a digits-only four-digit space has only 10,000 values.
Are these codes safe to use as passwords or API keys?
No. Coupon codes are printed, shared and typed in public places, and they are generated for typeability rather than maximum entropy. Use the API Key Generator or Password Generator for secrets. The coupon tool also warns when you turn on seeded mode, which is reproducible but not cryptographically secure.
References & standards
Related tools
ABA Routing Number Generator
Generate 9-digit US ABA routing numbers with weighted Mod-10 checks.
Address Generator
Generate realistic addresses in the correct format for 21 countries — single-line, multi-line, JSON or HTML — plus a postcode validator. Test data only, runs in your browser.
API Key Generator
Generate realistic test API keys — custom prefixes, lengths, alphabets, optional checksum, bulk .env/CSV export. Locally in your browser.
Argentina CUIT / CUIL Generator
Generate and validate 11-digit Argentine CUIT and CUIL numbers with AFIP Mod-11 check digits.
ASCII Text Art Generator
Turn text into large ASCII art banners with multiple figlet fonts
Australia ABN Generator
Generate and validate 11-digit Australian Business Numbers (ABN) using weighted Mod-89.