Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Universal Product Code
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Numbering == The number of UPC-A and UPC-E barcodes are limited by the standards used to create them. ; UPC-A: <math>\begin{align} \text{(possible values per left digit)} ^ \text{(left digits)} &\times \text{(possible values per right digit)} ^ \text{(5 right digits)}\\ = 10^6 &\times 10^5 = 100,000,000,000. \end{align}</math> ; UPC-E: <math>\begin{align} \text{(possible values per digit)} ^ \text{(digits)} &\times \text{(possible parity patterns per UPC-E number)}\\ = 10^6 &\times 2 = 2,000,000.\end{align}</math> === Number system digit === Below is a description of all possible number systems with the corresponding 12-digit UPC-A numbering scheme <u>L</u>LLLLLRRRRR<u>R</u>, where <u>L</u> denotes the numbering system digit and <u>R</u> the check digit. ; 0β1, 6β9 : For most products. The LLLLL digits are the manufacturer code (assigned by local [[GS1#Standards|GS1]] organization), and the RRRRR digits are the product code. ; 2 : Reserved for local use (store/warehouse), for items sold by variable weight. Variable-weight items, such as meats, fresh fruits, or vegetables, are assigned an item number by the store, if they are packaged there. In this case, the LLLLL is the item number, and the RRRRR is either the weight or the price, with the first R determining which (0 for weight). ; 3 : Drugs by [[National Drug Code]] (NDC) number. Pharmaceuticals in the U.S. use the middle 10 digits of the UPC as their NDC number. Though usually only [[over-the-counter drug]]s are scanned at point of sale, NDC-based UPCs are used on prescription drug packages and surgical products and, in this case, are commonly called UPN Codes.<ref>{{cite web|title=Barcodes for Pharmaceuticals and Surgical Products|url=https://upcs.com/blog/universal-product-number-upn-for-medical-pharmaceutical-surgical-products/|work=UPCs.com|date=24 March 2022|access-date=28 February 2023|archive-date=28 February 2023|archive-url=https://web.archive.org/web/20230228032708/https://upcs.com/blog/universal-product-number-upn-for-medical-pharmaceutical-surgical-products/|url-status=live}}</ref> ; 4 : Reserved for local use (store/warehouse), often for [[loyalty card]]s or store coupons. ; 5 : [[Coupon]]s. The LLLLL digits are digits 2-6 of the product's UPC prefix, the next three RRR are a family code (set by manufacturer or supplied by the coupon clearing house), and the next two RR are a value code (according to the GS1 value code table), which determines the amount of the discount. These coupons can be doubled or tripled.<ref>{{cite web|title=Barcodes for Coupons|url=https://www.simplybarcodes.com/barcode-coupons.html|work=SimplyBarcodes.com|access-date=16 February 2022|archive-date=16 February 2022|archive-url=https://web.archive.org/web/20220216234837/https://www.simplybarcodes.com/barcode-coupons.html|url-status=live}}</ref> === Check digit calculation === The UPC includes a check digit to detect common data entry errors. For example, UPC-A codes choose the check digit <math>x_{12}</math> to satisfy the ''check digit equation'': :<math>(3x_1 + x_2 + 3x_3 + x_4 + 3x_5 + x_6 + 3x_7 + x_8 + 3x_9 + x_{10} + 3x_{11} + x_{12}) \equiv 0 \pmod{10}.</math> If an entered code does not satisfy the equation, then it is not a valid UPC-A. The UPC-A check digit may be calculated as follows: # Sum the digits at [[Parity (mathematics)|odd]]-numbered positions (first, third, fifth,..., eleventh). # Multiply the result by 3. # Add the digit sum at [[Parity (mathematics)|even]]-numbered positions (second, fourth, sixth,..., tenth) to the result. # Find the result [[modulo]] 10 (i.e. the remainder, when divided by 10) and call it {{mvar|M}}. # If {{mvar|M}} is zero, then the check digit is 0; otherwise the check digit is {{math|10 − ''M''}}. For example, in a UPC-A barcode "03600029145''x''<sub>12</sub>", where {{math|''x''<sub>12</sub>}} is the unknown check digit, {{math|''x''<sub>12</sub>}} may be calculated by: # Sum the odd-numbered digits (0 + 6 + 0 + 2 + 1 + 5 = 14). # Multiply the result by 3 (14 × 3 = 42). # Add the even-numbered digits (42 + (3 + 0 + 0 + 9 + 4) = 58). # Find the result modulo 10 (58 mod 10 = 8 = ''M''). # If {{mvar|M}} is not 0, subtract {{mvar|M}} from 10 ({{math|1=10 − ''M'' = 10 − 8 = 2}}). Thus, the check digit {{math|''x''<sub>12</sub>}} is 2. The check digit equation is selected to have reasonable error detection properties (see [[Luhn algorithm]]). * UPC-A can detect 100% of single digit errors. *: A single digit error means exactly one digit is wrong. Let the difference modulo 10 of the erroneous digit and the correct digit be {{mvar|d}}. The value of {{mvar|d}} cannot be zero because that means the digits are the same, but {{mvar|d}} can be any other value in {1, 2, 3, 4, 5, 6, 7, 8, 9}. If the error digit is in an odd position (weight 1), the left hand side of check digit equation changes by {{mvar|d}} and the equivalence is no longer zero. If the error digit is in an even position (weight 3), then the left hand side changes by {{math|3''d''}}, but that change is also nonzero modulo 10, so the check digit equation is not satisfied. * UPC-A can detect about 89% of transposition errors. Specifically, if and only if the difference between two adjacent digits is 5, the UPC-A can't detect their transposition. *# If 2 neighboring digits are transposed, then one of the digits {{mvar|a}} will be weighted by 1, and the other digit {{math|1=''b'' = ''a'' + ''d''}} will be weighted by 3, where {{mvar|d}} is the difference between the two digits. If the digits were in their correct order, they would contribute *#::<math>1a + 3b = 1a + 3(a+d) = 4a + 3d</math> *#:to the left hand side of the check digit equation. In the transposed order, they contribute *#::<math>1b + 3a = 3a + 1(a+d) = 4a + d</math>. *#:to the LHS. Subtracting the two contributions gives how much they change the LHS: *#::<math>(4a + 3d) - (4a + d) = 2d</math> *#:An error will be detected as long as the modular change is nonzero; if {{math|1=2d ≡ 0}} modulo 10, then the change will not be detected. Consequently, only when the character difference {{math|''d'' ≡ 5}} will an error be undetected (when {{math|''d'' ≡ 0}} the degenerate "transposition" is not an error). *# Next consider how often a transposition has a distance {{mvar|d}} of 5. ::::Here is the ''Table of d-transpositions for UPC-A barcodes'', where <math> d \in \{0, 1, 2, \ldots, 9\}:</math> ::::{|class="wikitable" |+ Table of ''d''-transpositions for UPC-A barcodes ! {{diagonal split header | NΒ°| ''d''}} ! 0 !! 1 !! 2 !! 3 !! 4 !! 5 !! 6 !! 7 !! 8 !! 9 |- ! 1 | 0 0 || 0 1 || 0 2 || 0 3 || 0 4 || 0 5 || 0 6 || 0 7 || 0 8 || 0 9 |- ! 2 | 1 1 || 1 2 || 1 3 || 1 4 || 1 5 || 1 6 || 1 7 || 1 8 || 1 9 |- ! 3 | 2 2 || 2 3 || 2 4 || 2 5 || 2 6 || 2 7 || 2 8 || 2 9 |- ! 4 | 3 3 || 3 4 || 3 5 || 3 6 || 3 7 || 3 8 || 3 9 |- ! 5 | 4 4 || 4 5 || 4 6 || 4 7 || 4 8 || 4 9 |- ! 6 | 5 5 || 5 6 || 5 7 || 5 8 || 5 9 |- ! 7 | 6 6 || 6 7 || 6 8 || 6 9 |- ! 8 | 7 7 || 7 8 || 7 9 |- ! 9 | 8 8 || 8 9 |- ! 10 | 9 9 |- ! Sum | 10 || 18 || 16 || 14 || 12 || 10 || 8 || 6 || 4 || 2 |} ::::Row '''Sum''' contains the number of ''d''-transpositions, therefore the proportion of non-detectable transposition errors is (ignoring the transpositions where {{math|1=''d'' = 0}}): :::::<math>\frac{10}{18 + 16 + 14 + 12 + 10 + 8 + 6 + 4 + 2}=\frac{10}{90}=11.111\ldots\%.</math> :::::::::::::::::::::::::::β―
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)