How-to guide
How to generate unique barcode numbers for your products
When an internal Code 128 code is enough, when you need GS1-registered UPC or EAN numbers, and how to keep every barcode in your catalog unique.
By Bastien HugonFounder & Engineer8 min readPublished July 9, 2026
TL;DR
For in-store scanning only, generate sequential Code 128 barcodes yourself (or with an app that guarantees per-shop uniqueness) and keep a single source of truth in Shopify's variant barcode field. You only need GS1-registered UPC/EAN numbers when you sell where a global identity is required — Amazon, Google Shopping or wholesale to retailers. Never buy “recycled” UPCs from third-party resellers for those channels.
Every Shopify variant has a barcode field, and Shopify will neither fill it in nor police it. What goes in there — and whether the values are unique — is entirely up to you. Getting it wrong fails silently: a duplicated barcode scans perfectly at the register and rings up the wrong product, and nobody notices until inventory counts stop matching reality or a customer is charged for the wrong item.
The confusion usually starts with terminology. A SKU is your internal reference for a variant — free-form text that never needs to scan. A barcode is the machine-readable identity printed on the physical label, and the value in Shopify's barcode field is what your POS looks up when the scanner beeps. The two can look similar; they do different jobs. This guide is about the barcode field.
There are two legitimate sources for barcode numbers: codes you create yourself for internal use, and GS1-registered numbers for products that travel outside your own store. Below is how to decide between them, how to generate internal codes that cannot collide, and what to do with the barcodes your products already carry. Once the numbers exist, the printing side is covered in How to print Avery 5160 barcode labels from Shopify for sheets and How to print barcode labels on a Dymo printer from Shopify for rolls.
Internal codes vs GS1: which do you need?
If your labels are scanned by your own equipment and nobody else's — your POS, your stockroom scanner, your warehouse — you do not need anyone's permission or registry. Any unique string rendered as a Code 128 barcode works: the scanner reads it, Shopify matches it to the variant, done. This covers most of independent retail — price tags, shelf labels, jewelry tags, restock labels.
You need GS1-registered numbers the moment your products are scanned by someone else's systems: selling wholesale to other retailers, listing on marketplaces that require a GTIN (a UPC or EAN), or moving goods through distributors. In that world the number must be globally unique, which is what GS1 — the organization that runs the system — provides by licensing you a company prefix. You assign the remaining digits per product, and the final digit is a computed check digit.
The tempting shortcut — inventing your own 12- or 13-digit numbers so they look like UPCs — is a trap. Made-up GTINs can collide with real products registered to someone else, and marketplaces validate submitted GTINs against the GS1 registry. If a sales channel demands a GTIN, license one properly; for everything else, an honest internal Code 128 is simpler and entirely sufficient.
Set up unique barcode numbers, step by step
- 01
Audit what you already have
Export your products, or filter variants in the admin, and look at the barcode field across the whole catalog. You are sorting variants into three groups: no barcode, duplicated barcode, and valid existing code. Each group gets a different treatment, so count them before generating anything.
- 02
Keep every code that already works
Products that arrive from manufacturers usually carry a UPC or EAN on the packaging, and that number is already globally unique — it is the product's identity everywhere, not just in your store. Enter it in the barcode field as-is and print it as-is. Never replace a manufacturer code with a generated one: you would sever the product's link to its real-world identity for no benefit.
- 03
Choose Code 128 for the codes you create
Code 128 encodes letters, digits and punctuation at high density, and every retail laser or camera scanner reads it. Unlike UPC and EAN it has no fixed length and no registry — which is exactly right for internal codes. Reserve UPC/EAN rendering for numbers that really are registered GTINs.
- 04
Pick a boring, sequential scheme
The safest internal scheme is a short fixed prefix plus a zero-padded sequence: SHOP-000001, SHOP-000002, and so on. Do not encode prices, stock counts or anything else that changes — a barcode is an identity, not a data record, and 'smart' codes go stale the day the price moves. Sequential numbers also make gaps and duplicates easy to spot in an export.
- 05
Check uniqueness against the whole catalog before saving
Uniqueness inside today's batch is not enough. A new code must not collide with anything already sitting in the barcode field anywhere in your catalog — including values typed by hand two years ago. Whatever tool generates your codes should verify each one against every existing barcode value before it writes anything.
- 06
Save codes to the variant, not to a spreadsheet
The barcode's home is the variant's barcode field in Shopify: that is what POS reads at checkout and what any label tool reads at print time. A spreadsheet mapping maintained on the side drifts from reality the day someone edits a product. Write the code to the variant the moment it is generated, then print from the variant.
- 07
Print one test label and scan it
Before a full run, print a single label and scan it with the reader you actually use at the counter. This verifies the whole chain at once: number saved on the variant, code rendered correctly, scan resolving to the right product. Then print the batch.
Code 128 vs UPC-A vs EAN-13
| Symbology | Characters | Length | Registration | Typical use |
|---|---|---|---|---|
| Code 128 | Letters, digits, punctuation | Variable | None needed | Internal labels: price tags, shelf and restock labels |
| UPC-A | Digits | 12 (ends in a check digit) | GS1 company prefix | Retail products sold in North America |
| EAN-13 | Digits | 13 (ends in a check digit) | GS1 company prefix | Retail products sold internationally |
The check digit is why you cannot hand-type a plausible-looking UPC. The final digit of a UPC-A or EAN-13 is computed from all the others, and scanners recompute it on every read — a number with a broken check digit is rejected by the hardware itself before it ever reaches Shopify. Code 128 handles its check character internally and accepts any content, which is one more reason it is the low-friction choice for internal codes.
How duplicates creep in
Duplicates rarely come from one obvious mistake. They come from CSV imports where a barcode value was copied down a column; from duplicating a product to create a variation and forgetting that the barcode came along; from two staff members generating codes at the same time with a tool that checks nothing; and from re-running an import that assigned the same range twice.
The fix is structural, not behavioral. Uniqueness has to be enforced where codes are created: a generator that issues numbers from a single persistent sequence, and refuses to write any code that already exists in the catalog, makes duplicates impossible rather than merely unlikely — and that guarantee has to hold even when two people generate at once. If your catalog already contains duplicates from an older tool, fix them deliberately: decide which variant keeps the code, generate fresh codes for the others, and reprint those labels.
One boundary worth drawing: if a printed label refuses to scan after all this, the problem is physical, not numerical. Size, quiet zone, contrast, and print scaling are diagnosed in order in Barcode labels won't scan: 6 fixes.
Doing this with Solvi Barcode Labels
Solvi Barcode Labels automates exactly this policy. When you select products to print, the app detects variants with an empty barcode field and offers to generate the missing codes in one click. Codes are unique Code 128 values issued from a per-store sequence, verified against your entire catalog before anything is written, and saved immediately to the variant's barcode field in Shopify — the code exists on the variant before any label prints, so it cannot disappear or diverge from what is on paper.
Existing codes are never touched. A valid 12- or 13-digit GTIN already on a variant is rendered in its proper UPC-A or EAN-13 symbology; anything else prints as Code 128, exactly as stored. Pre-existing duplicates in the catalog are surfaced with a warning that lists the affected variants, and regenerating them is always an explicit choice with a confirmation step — never automatic.
Generation works this way on every plan, because unique codes are a matter of reliability, not an upsell.
Frequently asked questions
Can I just make up my own barcode numbers?
For internal use — your own store, your own POS, your own stockroom — yes: any Code 128 value works as long as every variant's value is unique within your catalog. What you must not do is invent digits that look like UPC/EAN codes for channels that require registered GTINs; Amazon and Google validate them against the GS1 database.
What is the difference between a barcode, a UPC, and a GTIN?
A barcode is the printed symbol; UPC and EAN are specific numbering standards (12 and 13 digits) within the GTIN family that GS1 administers globally. Code 128 is a symbology that can encode any characters, including internal codes that belong to no registry. Shopify's “barcode” field stores the value — which standard it follows is up to you.
Are cheap UPC codes from third-party resellers safe to use?
Not for marketplaces. Resold UPCs come from old GS1 prefixes registered to another company, so the GS1 database attributes them to that company — and Amazon checks. Listings built on recycled codes risk suppression, and the few dollars saved are not worth relisting your catalog. For marketplace selling, license your own numbers from GS1.
How do I find duplicate barcodes already in my Shopify catalog?
Export your products to CSV and sort or pivot on the “Variant Barcode” column — duplicates line up next to each other. Fix them at the source (the variant), not on the printed label. Apps that generate barcodes should check new values against the whole catalog before saving; that is the only durable way to keep the field clean.
Related guides
How-to
How to print Avery 5160 barcode labels from Shopify
The exact Avery 5160 geometry — 2.625″ × 1″ labels, 30 per sheet — plus the step-by-step workflow and print settings that keep all thirty barcodes aligned.
8 min read
How-to
How to print barcode labels on a Dymo printer from Shopify
Rolls are not sheets: set the PDF page size to the label size, print at 100%, and use die-cut media — barcode printing on a Dymo LabelWriter, step by step.
8 min read
How-to
How to print barcode labels on a Zebra printer from Shopify
Zebra printers speak two languages — ZPL and plain PDF. For Shopify product labels, the PDF route wins: set the page size to the label size, calibrate the media, print at 100%. Step by step.
8 min read
How-to
How to print barcode labels on a Brother QL from Shopify
Brother QL printers take two kinds of DK rolls — die-cut and continuous — and the setting that ruins barcodes is auto-cut length. Page size = label size, 100% scale, and the right roll: step by step.
8 min read
Do this in minutes with Solvi Barcode Labels
Print barcode labels right the first time: unique codes, true-size sheets, ready in minutes.