How to validate UPC and GS1 barcodes before you list on Shopify

a product barcode being scanned and validated with a green checkmark, a magnifier over the final check digit

If you want to validate a UPC barcode on Shopify before you push products to Google or a marketplace, the fastest win is to catch the bad numbers before they ever hit a feed. Say you run a store with 400 SKUs and you typed the barcodes in by hand, or worse, someone pasted them from an old spreadsheet. A single wrong digit is invisible to the human eye. It is not invisible to Google Merchant Center, which will flag it, disapprove the product, and quietly cost you impressions.

We build Shopify apps for a living, so we see barcode chaos constantly. Merchants copy numbers, reuse them, drop a leading zero, or make one up because they are in a hurry. Then the rejections start rolling in and nobody knows why. This post walks through what a barcode actually is, how the math behind it works, and how to check yours before a single product goes live.

Quick promise: no jargon dump. Just the parts that keep your listings approved.

In this post

Why barcodes matter on Shopify

A barcode ties your product to the global product catalog. When you list a physical, branded item, Google and most marketplaces want a GTIN, the Global Trade Item Number, and for a lot of categories they treat it as required, not optional. Why? Because that number lets them match your listing to the same product sold by other retailers, pull in reviews, and slot you into price comparisons. No valid GTIN, and you often lose Shopping placement.

Think about what happens on the retailer side. A marketplace ingests thousands of feeds a day. It cannot eyeball your product. It reads the barcode, checks the math, checks the prefix, and decides in milliseconds whether you are legit. If the number does not validate, the product gets held or rejected before a human ever sees it.

And here is the part that stings. Shopify itself does not stop you from saving a garbage barcode. The field accepts almost anything. So you can build a whole catalog that looks fine in your admin, sync it to a Google Shopping feed, and only discover the problem days later when your disapproval count climbs. That gap between “saved in Shopify” and “accepted by Google” is exactly where merchants get burned.

UPC vs EAN vs GTIN vs GS1

These four terms get mixed up all the time, and the confusion causes real listing errors. So let’s get them straight in plain terms.

UPC-A is the 12-digit barcode you see on packaging across North America. EAN-13 is its 13-digit cousin used widely in Europe and much of the rest of the world. Both of these are GTINs. GTIN is not a competing format, it is the umbrella name for the number that identifies a trade item, whether that number is 8, 12, 13, or 14 digits long. So a UPC is a GTIN. An EAN is a GTIN. When Google asks for a “GTIN” it will happily accept your valid UPC or EAN.

Where does GS1 fit? GS1 is the standards organization that issues the company prefixes that sit at the start of a real barcode. When a brand joins GS1, it gets a company prefix, and every product number it creates begins with that prefix. That is what makes the number globally unique instead of just a random string. You do not buy a UPC from Shopify. You get your number range from GS1 (or from the brand that manufactured the item).

The short version, said inline: UPC and EAN are formats, GTIN is the category they belong to, and GS1 is the body that hands out the underlying number ranges. Get that mental model right and half the barcode questions answer themselves.

How barcode validation works

Every UPC and EAN ends with a check digit, and that single digit is the whole trick. The last digit is a math checksum calculated from all the digits before it. Multiply certain positions by 3, sum everything, and the check digit is whatever value makes the total land on a clean multiple of ten. That means a valid barcode is internally consistent. Change one digit anywhere and the checksum breaks.

Why does this matter to you? Because a randomly typed 12-digit number has roughly a 1-in-10 chance of passing the check digit by luck, and essentially zero chance of also carrying a real GS1 company prefix. So validation catches two different failures. First, the format and checksum: is this even a structurally valid number? Second, the origin: does this number trace back to a real GS1 prefix, or did somebody invent it? A number can pass the checksum and still be fake if it was never issued to anyone.

And here is what most guides skip. Marketplaces do not just run the checksum. Many of them also check the prefix against known GS1 ranges. So “my number has 12 digits and passes the check digit” is necessary but not always sufficient. A real, issued number from a real brand is what actually clears the bar.

Reality check: the checksum is your first line of defense, and it catches the overwhelming majority of typos, drops, and transpositions before they ever reach a feed. Start there.

How to add barcodes in Shopify

Shopify stores the barcode on the variant, not the product. That distinction matters if you sell in sizes and colors, because each variant needs its own unique number. Two ways to get them in.

One variant at a time

  1. Open the product in your Shopify admin.
  2. Scroll to the Variants section and click into a specific variant.
  3. Find the Barcode field under inventory and paste the GTIN for that exact variant.
  4. Save, then repeat for every variant (not just the parent product).

In bulk via a products CSV

For anything past a handful of products, do it in bulk. Shopify’s products CSV has a “Variant Barcode” column. Fill it, import, done. If you are new to that file, our Shopify product CSV import guide walks through the columns, and the bulk import guide covers doing this at scale without breaking existing data. One warning we cannot repeat enough: spreadsheets love to eat leading zeros. More on that below, because it wrecks more barcodes than any other single mistake.

Need to generate internal SKUs alongside your barcodes? Those are different things (a SKU is your private stock code, a barcode is the public GTIN), and our SKU generator handles the SKU side so you do not conflate the two.

How to validate before you list

The goal is simple: catch bad numbers on your desk, not in Google’s rejection queue. To validate a UPC barcode for Shopify properly, check three things in order, and check them before the product is ever published.

  1. Length. Is it exactly 12 digits for a UPC-A, or 13 for an EAN-13? A stray space or a dropped digit fails here first.
  2. Check digit. Does the checksum math work out? This is where typos and transpositions get caught.
  3. Format. Is it all digits, no letters, no dashes, no scientific notation like 6.9E+11 that a spreadsheet snuck in?

Rather than do that math by hand across hundreds of rows, paste your numbers into our free barcode validator. It checks the length, runs the check-digit calculation, and confirms the format so you know a number is structurally sound before it hits a feed. Run your whole list through it after any CSV export, since that export is exactly the step where zeros vanish and formats mangle.

One rule we will die on: do not invent barcodes, and do not reuse a barcode from another product because it “looked close enough.” A validator confirms a number is well-formed. It cannot make a fake number real, and it cannot give you the right to a number that belongs to another company. If you manufacture your own goods and have no barcodes at all, you get them from GS1, not from a random online list.

Common barcode mistakes

After years of watching catalogs sync (and break), the same handful of errors come up again and again. Here they are, ranked by how often they bite.

  • Made-up numbers. Somebody types a plausible-looking 12 digits to fill the field. It may even pass the checksum by chance, but it belongs to nobody, and marketplaces that verify prefixes will reject it.
  • Reused numbers across products. Every distinct product (and every variant) needs its own barcode. Copy one across a size run and you get duplicate-GTIN errors.
  • Wrong length. A UPC-A is 12 digits. Paste 11 or 14 and it fails validation instantly. Often this is a dropped or doubled digit during a copy.
  • Leading-zero loss. The big one. Open a barcode list in a spreadsheet and any number starting with 0 silently becomes one digit shorter, because the app treats it as a number, not text. A 12-digit UPC starting with 0 turns into 11 digits and every downstream check fails.
  • Scientific notation. Long numbers get auto-converted to something like 6.9E+11. Now it is not even digits anymore.

Why does a spreadsheet default to destroying barcodes? Honestly, no idea, and it makes no sense for anyone in ecommerce. The fix is to format the barcode column as Text before you paste, every single time. Then validate the export. Boring, yes. But it is the difference between a clean feed and a week of firefighting disapprovals.

Barcode type reference

Barcode typeDigitsWhere it is used
UPC-A12North American retail packaging; a GTIN Google accepts
EAN-1313Europe and most of the world; a GTIN Google accepts
EAN-88Small packaging where a full barcode will not fit
GTIN-14 (ITF-14)14Cases and cartons of multiple units, not single retail items
GTIN8, 12, 13, or 14The umbrella term; UPC and EAN are both GTINs

Clean barcodes are one layer of a listing that Google trusts. The other layers are your images and how variants are presented, which is our home turf. We build two Shopify apps for exactly that. Rubik Variant Images assigns the right photos, videos, and 3D models to each variant and filters the product-page gallery so shoppers only see the color they picked. If instead you list each color as a separate product, Rubik Combined Listings links those separate products into one listing with collection swatches. Both are Built for Shopify, both metafield-based, and both help the feed you are so carefully validating actually convert.

FAQ

How do I validate a UPC barcode for Shopify?

Check three things before you list: the length (12 digits for UPC-A), the check digit (the last digit must satisfy the checksum math), and the format (digits only, no spaces or scientific notation). Paste your numbers into a barcode validator after any CSV export to confirm all three at once.

Is a UPC the same as a GTIN?

Yes, a UPC is a type of GTIN. GTIN is the umbrella term for the number that identifies a trade item, and it comes in 8, 12, 13, and 14-digit forms. A 12-digit UPC-A and a 13-digit EAN-13 are both GTINs, so when Google asks for a GTIN, your valid UPC qualifies.

Where do I get real barcodes for my products?

For your own products, you get number ranges from GS1, the organization that issues company prefixes. If you resell branded goods, use the manufacturer’s existing GTIN. Never invent a barcode or reuse one from another product, because marketplaces that verify prefixes will reject numbers that were never issued.

Why did my spreadsheet break my barcodes?

Spreadsheets treat barcode columns as numbers by default, which drops leading zeros and converts long values into scientific notation like 6.9E+11. A 12-digit UPC starting with 0 becomes 11 digits and fails. Format the barcode column as Text before pasting, then validate the export.

Does Shopify check barcodes for me?

No. Shopify’s Barcode field accepts almost any value and does not run a check-digit test. Your catalog can look fine in the admin and still fail when synced to Google or a marketplace. That is why you validate the numbers yourself before publishing rather than after rejections start.

Does every variant need its own barcode?

Yes. Shopify stores the barcode on the variant, and every distinct variant (each size and color combination) needs its own unique GTIN. Reusing one barcode across a size run produces duplicate-GTIN errors in feeds. Assign one number per variant, in the Variant Barcode column if you are importing in bulk.

Co-Founder at Craftshift