Useful Tools

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.

8 min read · Published July 9, 2026 · Updated July 9, 2026

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

  1. 1

    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.

  2. 2

    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.

  3. 3

    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.

  4. 4

    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.

  5. 5

    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.

  6. 6

    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.

  7. 7

    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

SymbologyCharactersLengthRegistrationTypical use
Code 128Letters, digits, punctuationVariableNone neededInternal labels: price tags, shelf and restock labels
UPC-ADigits12 (ends in a check digit)GS1 company prefixRetail products sold in North America
EAN-13Digits13 (ends in a check digit)GS1 company prefixRetail 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.

Two failure modes here are silent, and silence is the trap. Overwriting an existing manufacturer UPC/EAN destroys the product's real identity — there is no undo once the original number is gone from your store, short of finding it again on the physical packaging. And a duplicate barcode never announces itself: both labels scan cleanly, and the register simply picks whichever variant it finds. Check before you write, and never regenerate codes that already work.

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.

Related guides

Do this in minutes with Solvi Barcode Labels

Print barcode labels right the first time: unique codes, true-size sheets, ready in minutes.