How does a barcode know the price? It doesn't: the price lives in the store
The bars on a product hold only an ID number, the GTIN. The scanner checks that number with a quick sum, and the store's system looks up the price in its own file.
Published Updated 7 min readApplies to: Most countries
Short answer
On most packaged goods, the barcode doesn't contain the price. It holds an ID number called a GTIN: 12 digits on a UPC-A, 13 on an EAN-13. The scanner measures the bars, redoes the check-digit math and, if it matches, the store's system looks that number up in its own price file. The exception is labels on items weighed in the store, which can carry the price or weight in the code, in a layout set country by country.
Key points
- 1The bars hold an ID number, the GTIN, not the price.
- 2The price comes from the store's own price file, which is why the same product can cost different amounts in different stores.
- 3The first digits show which GS1 office registered the company, not the country the product was made in.
- 4The last digit is a check: it catches any single misread digit and about 89% of swaps between neighbors.
- 5Items weighed in store are the exception: the scale label can carry the price or the weight in the code.
A number, a check and a lookup
You scan an item at checkout, the register beeps, and the price pops up. It looks as if the barcode "knows" the price. On most packaged goods, it doesn't: the bars hold only a number that identifies the product.
According to the specifications of GS1, the organization that runs these codes, identifying products is what lets stores automate the checkout "through Price Look Up (PLU) files." The scanner reads the number, checks that the read is right, and the store's system looks that number up in its own file.
From barcode to price: Barcode (a number) → Scanner (measures the bars) [reading the bars]; Scanner (measures the bars) → Check digit (verifies the math) [check-digit math]; Check digit (verifies the math) → Store system (price file) [beep and lookup]
What the bars hold
The number is called a GTIN (Global Trade Item Number). On an EAN-13 barcode it has 13 digits; on a UPC-A, 12. The symbol can only encode the digits 0 to 9: no letters, and no hidden price.
A GTIN has three parts: a company prefix, an item reference and a check digit. The company prefix is 4 to 12 digits long, so the line between "company" and "product" moves from one company to the next. In our diagrams, the fixed 3 + 9 + 1 split is a simplification.
A 12-digit UPC is the same kind of number with an implied leading zero. GS1's own example: for the 12-digit GTIN 614141234561, "the GS1 Prefix is 061, not 614." That's why a scanner can decode a UPC-A as a 13-digit number that starts with 0.
The first digits aren't the country
The first digits form the GS1 Prefix, which GS1 hands out to its national member organizations to spread out the work of issuing numbers. GS1 US holds the ranges 001 to 019, 030 to 039 and 060 to 139. A code in those ranges tells you the company registered with GS1 US.
Some prefixes don't belong to any country. 978 and 979 are books (ISBN), 977 is magazines and other periodicals (ISSN), 952 is set aside for demonstrations and examples, 20 to 29 are restricted numbers for use inside a store, and 99 is coupons. That's why the full numbers we show start with 952: they can't clash with a real product.
How the scanner reads the bars
Each digit takes up 7 modules, drawn as 2 bars and 2 spaces, each 1 to 4 modules wide. With the guard patterns at the start, middle and end, an EAN-13 is 95 modules wide (12 × 7 + 11). The nominal module width is 0.330 mm.
A neat detail: the first of the 13 digits has no bars of its own. It's hidden in the mix of two pattern sets (A and B) used in the left half. When that digit is 0, the left half uses only set A, which is exactly a UPC-A.
Laser scanners and linear imagers read linear barcodes, but they can't read 2D codes. That takes 2D imagers or cameras, which read both.
The check-digit math
Before the beep, the scanner verifies the last digit. GS1's rule is the same for every fixed-length number (GTIN-8, -12, -13 and -14, among others): take the digits without the check digit and, starting from the rightmost, multiply them by 3, 1, 3, 1… Add up the results and subtract the sum from the nearest equal or higher multiple of ten. What's left is the check digit.
In GS1's own example, the number without its check digit is 629104150021. The products are 6, 6, 9, 3, 0, 12, 1, 15, 0, 0, 2 and 3, which add up to 57. The next multiple of ten is 60, and 60 − 57 = 3. The full number is 6291041500213.
Where's the price?: Packaged, fixed size: Barcode = an ID number (GTIN); Same barcode in every store; Price in the store system's price file; A new price needs no new barcode | Weighed in store: Prefix 02 or 20 to 29, restricted use; The scale weighs, prices and prints a label; The code can carry the price or the weight; Layout set country by country
What the check catches, and what slips through
If a single digit is misread or mistyped, the check always flags it, in any position: the weights 1 and 3 change the sum without ever landing on a multiple of 10. Swapping two neighboring digits, though, slips through when they differ by 5 (0 and 5, 1 and 6, 2 and 7, 3 and 8, 4 and 9). Of the 90 possible swaps between different digits, 80 are caught: about 89%.
Swapping two digits one place apart is never caught, because both positions carry the same weight. And with two errors at once, the sum can match by coincidence.
Try the check digit
In the simulator, pick a 952 demo number, GS1's worked example or a 12-digit UPC and watch the math digit by digit. Then add a misread: one wrong digit, two neighbors swapped or a swap two places apart. The test cases include swapping 1 and 6, which slips through.
Check-digit simulator: pick a 12-digit number, see the weights 3 and 1 from the right, the sum and the check digit, then add a misread to see whether the check catches it.
So where does the price come from?
When the sum matches, the scanner beeps and the register looks the GTIN up in the store's price file. That's why the same product can have a different price in every store, and a price change doesn't mean reprinting the package.
The exception is variable-measure items, sold at a fixed price per unit of weight and weighed in the store (or labeled by the supplier). For these, GS1 organizations use the prefixes 02 and 20 to 29. The scale weighs the item, works out the price and prints a barcode label whose digits can stand for the product type, the net weight, the calculated price or the number of units. Each country sets its own layout. The one GS1 US specifies for North America is 0 2, a 5-digit item reference, a price verifier digit, a 4-digit price and the check digit, and many other GS1 organizations use the same structure. The price even gets its own extra verifier digit.
From 1974 to 2D codes
From the first beep to 2D: April 1, 1973 The UPC is officially born (According to IBM) → June 26, 1974 First scan in a store (Troy, Ohio: a 67-cent pack of Juicy Fruit gum) → 2022–23 Over 10 billion scans a day (GS1's own figure) → 2024–25 51 countries piloting or adopting 2D (90% of global GDP, according to GS1) → End of 2027 Checkouts that read 2D codes too (GS1's goal (Sunrise 2027), without switching off the bars)
According to IBM, the UPC was officially born on April 1, 1973, and the first retail scan came on June 26, 1974, at Marsh's Supermarket in Troy, Ohio: a 67-cent pack of Wrigley's Juicy Fruit gum. Today, GS1 says its barcodes are scanned over 10 billion times a day, on more than 1 billion products from over 2 million companies in 150 countries.
Next up is 2D. GS1 has an ambition for checkouts around the world to read 2D barcodes by the end of 2027. That doesn't switch off the bars: a 2D code can appear in addition to the linear barcode, and GS1 US notes that it isn't necessary to implement every 2D capability by that date. The 2D code still carries the GTIN, through GS1 Digital Link. According to GS1, 51 countries, representing 90% of global GDP, are already piloting or implementing 2D barcodes. And because in-store weight labels can't go into 2D codes, GS1 strongly recommends GTINs for fresh food too.
Questions people ask
Does a barcode contain the price?
On most packaged goods, no. It holds an ID number, the GTIN, and the store's system looks that number up in its own price file. The exception is labels on items weighed in the store, with prefix 02 or 20 to 29, which can carry the price or the weight in the code.
Do the first digits tell you where a product was made?
No. They show which GS1 member organization registered the company. In the US, GS1 US holds the ranges 001 to 019, 030 to 039 and 060 to 139. GS1 says its prefixes do not identify the country of origin, because companies can make products anywhere.
Why do UPCs have 12 digits and other barcodes 13?
A 12-digit UPC-A is the same kind of number as a 13-digit EAN-13, with an implied leading zero. GS1's example: the 12-digit GTIN 614141234561 has the prefix 061, not 614.
What is the last digit of a barcode for?
It's the check digit. The scanner redoes a quick sum with the other digits (weights 3 and 1 from the right) and accepts the read only if it matches. That catches any single misread digit and about 89% of swaps between neighboring digits.
Are barcodes going away in 2027?
No. GS1's goal is for checkouts to be able to read 2D codes too by the end of 2027. A 2D code can appear in addition to the linear barcode, and it still carries the same GTIN.
When was the first barcode scanned in a store?
According to IBM, on June 26, 1974, at Marsh's Supermarket in Troy, Ohio: a 67-cent pack of Wrigley's Juicy Fruit gum.
Sources and notes
- Confirmed factGS1 General Specifications, Release 26.0 (Jan. 2026), GS1GTIN and EAN/UPC (§5.2.1), PLU files at checkout (§2.1.1), prefixes (§1.2.3), variable measure and the North American layout (§2.1.12.2), check digit (§7.9.1), 0.330 mm modules, 1D vs 2D scanners, the 2027 2D goal.
- Confirmed factGS1 Company Prefix, GS1Prefix table (GS1 US 001–019, 030–039, 060–139; 952 demos; 977, 978–979, 20–29, 99). Prefixes do not identify country of origin. Implied leading zero (614141234561 → 061).
- Confirmed factHow to calculate a check digit manually, GS1Example 629104150021: sum 57, check digit 3.
- Confirmed factThe Universal Product Code, IBMUPC officially born April 1, 1973; first scan June 26, 1974, in Troy, Ohio (Juicy Fruit, 67 cents); 95 bits. IBM's own account.
- EstimateGS1 Year in Review 2022–2023, GS1Over 10 billion scans a day; over 1 billion products; over 2 million companies in 150 countries. GS1's own approximate, self-reported figures.
- Confirmed factGS1 Year in Review 2024/25, GS151 countries, representing 90% of global GDP, piloting or implementing 2D barcodes (GS1 self-report).
- Confirmed factWhat is GS1 Sunrise 2027?, GS1 USTransition to 2D barcodes at checkout; not every 2D capability is needed by 2027; QR codes should use GS1 Digital Link and include the GTIN.
- Confirmed factUniversal Product Code (oldid 1378790865), WikipediaSecondary source: a neighbor swap is missed only when the digits differ by 5; about 89%. Corroborates the 1974 first scan.
- Confirmed factInternational Article Number (oldid 1366893004), WikipediaSecondary source: a single wrong digit is always caught.
- EstimateAbout 89% of neighbor swaps caughtVIZHOW's math: 80 of the 90 ordered pairs of different digits (simulation on 20,000 GTIN-13s: 11.0% missed). Swaps two places apart: never caught (same weight).
- Estimate95 modules = 12 × 7 + 11VIZHOW's arithmetic from GS1 (7 modules per digit, 11 in the guards); matches IBM's "95 bits."
- EstimateDemo numbers 952…9520016123452 and its misread variants were computed by VIZHOW with GS1's rule. Prefix 952 is reserved for demonstrations.
- Teaching simplificationSame product, each store's own priceFollows from the store's price file (GS1 §2.1.1); no source we opened says it in these words.
- Teaching simplificationThe 3 + 9 + 1 split in our diagramsA company prefix is 4 to 12 digits long, so the line between company and product moves.
- Teaching simplificationRead → check → beep → priceSequence assembled from GS1 (§5.2.1, §7.9 and §2.1.1) for the diagram.
- Teaching simplificationThe check digit isn't securityInferred from GS1 (§7.9.2, §2.1.12.2): it catches misreads and typos; anyone can compute a valid check digit.