Home · Learn · UPC Check Digit Calculator and Formula
UPC Check Digit Calculator and Formula
The 12th digit of a UPC-A barcode is a checksum that detects scan errors. Here is exactly how it is computed, with worked examples — and our generator computes it automatically when you enter the first 11 digits.
Every UPC-A barcode ends with a check digit — the 12th digit, computed from the first 11. Its purpose: catch single-digit transposition errors when humans key in barcodes. If the cashier or warehouse worker types one digit wrong, the check digit will not match and the system rejects the entry. EAN-13 (13th digit) and EAN-8 (8th digit) work the same way with the same formula.
You almost never need to compute the check digit by hand — any barcode generator (including ours) does it for you when you enter the first 11 digits. But understanding the math is useful when you are debugging a 'GTIN invalid' error from Amazon or Walmart, or when you need to verify a UPC pulled from a database.
The GS1 Mod 10 check digit formula
Step 1: take the first 11 digits of the UPC. Step 2: multiply odd-position digits (1st, 3rd, 5th, 7th, 9th, 11th — left to right) by 3, multiply even-position digits (2nd, 4th, 6th, 8th, 10th) by 1. Step 3: sum all the products. Step 4: find the smallest number that, when added to the sum, gives a multiple of 10. That number is your check digit. Algebraically: check digit = (10 − (sum mod 10)) mod 10. The double 'mod 10' handles the edge case where sum mod 10 = 0 (check digit is 0, not 10).
Worked example 1: UPC 03600029145?
Eleven digits: 0, 3, 6, 0, 0, 0, 2, 9, 1, 4, 5. Odd positions (×3): 0+6+0+2+1+5 = 14, ×3 = 42. Even positions (×1): 3+0+0+9+4 = 16. Sum = 42 + 16 = 58. Next multiple of 10 is 60. Check digit = 60 − 58 = 2. Full UPC: 036000291452. This is a real Charmin Ultra Strong toilet paper UPC — scan it on Amazon to verify.
Worked example 2: UPC 01234567890?
Eleven digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0. Odd positions (×3): 0+2+4+6+8+0 = 20, ×3 = 60. Even positions (×1): 1+3+5+7+9 = 25. Sum = 60 + 25 = 85. Next multiple of 10 is 90. Check digit = 90 − 85 = 5. Full UPC: 012345678905. This is the canonical 'sample UPC' used in tutorials.
Worked example 3: when sum is already a multiple of 10
Eleven digits: 8, 1, 4, 1, 4, 1, 0, 6, 0, 4, 9. Odd (×3): 8+4+4+0+0+9 = 25, ×3 = 75. Even (×1): 1+1+1+6+4 = 13. Sum = 75 + 13 = 88. Next multiple of 10 is 90. Check digit = 2. Full: 814141060492. Try one yourself: digits 0,0,0,0,0,0,0,0,0,0,0 — odd sum 0, even sum 0, total 0, check digit = (10 − 0) mod 10 = 0. The all-zero UPC has check digit 0.
EAN-13 and EAN-8 use the same formula with different position weights
EAN-13: take 12 digits, alternate ×1 and ×3 STARTING with ×1 from the LEFT (opposite of UPC-A). EAN-8: 7 digits, alternate ×3 and ×1 starting with ×3 from the left. ITF-14: 13 digits, alternate ×3 and ×1 starting with ×3 from the left (same as EAN-8 logic). The 'mod 10' modulus is identical across all formats — only the position weighting flips. This is why a UPC-A converted to GTIN-14 (prepend two zeros) keeps the same check digit — the weighting pattern realigns.
When the check digit alone is not enough
The Mod 10 formula catches every single-digit error and most adjacent-digit transpositions, but NOT swaps where the digits differ by 5 (e.g., 0↔5, 1↔6, 2↔7, 3↔8, 4↔9). A keypunch operator could type 360200291452 instead of 036000291452 and the check digit would still pass — so 'check digit valid' is necessary but not sufficient. The next layer of validation is GS1 GEPIR lookup: even with a valid check digit, the Company Prefix must trace back to a licensed company. This is what Amazon, Walmart, and Target verify when they reject 'invalid GTIN' submissions.
FAQ
How do you calculate a UPC check digit?
Take the first 11 digits. Multiply digits in odd positions (1st, 3rd, 5th, 7th, 9th, 11th from the left) by 3. Multiply digits in even positions (2nd, 4th, 6th, 8th, 10th) by 1. Sum all the products. The check digit is the smallest number that, added to this sum, produces a multiple of 10. Algebraically: check digit = (10 − (sum mod 10)) mod 10.
What is the check digit for UPC 012345678905?
5. Eleven digits 01234567890 give odd-position sum 0+2+4+6+8+0=20×3=60, even-position sum 1+3+5+7+9=25, total 85. Next multiple of 10 is 90. Check digit = 90−85 = 5.
Why does UPC have a check digit?
To detect data entry and scanning errors. The check digit catches every single-digit mistype and most adjacent-digit transpositions (e.g., typing 12 instead of 21). At the point of sale or warehouse receiving, the scanner or keying system rejects any 12-digit number where the check digit doesn't compute correctly from the first 11 digits — preventing bad data from entering the inventory system.
Is the EAN-13 check digit calculated the same way as UPC?
Almost. EAN-13 uses the same Mod 10 algorithm but alternates weighting in the OPPOSITE direction — odd positions get ×1 and even get ×3 (UPC-A does odd ×3 and even ×1). The math comes out equivalent because EAN-13 has 12 input digits and UPC-A has 11. When you convert UPC-A 012345678905 to GTIN-13 by prepending a zero (0012345678905), the check digit remains 5 — the weighting pattern realigns correctly.
Can a UPC have a check digit of 0?
Yes. When the sum of weighted products is already an exact multiple of 10, the check digit is 0 (not 10). The formula (10 − (sum mod 10)) mod 10 handles this edge case. Example: UPC 78696515770? has weighted sum 80, next multiple is 80 itself, check digit = (10 − 0) mod 10 = 0. Full UPC: 786965157700.
Do I need to compute the check digit myself?
No — every barcode generator computes it for you. You enter the first 11 digits (or 12 for EAN-13), the generator appends the check digit and renders the barcode. Our generator does this automatically; you don't need to type the check digit. The math matters when you're debugging a 'GTIN invalid' error or verifying a UPC pulled from a third-party database.
Related generators
Need a real barcode now?
Generate a valid UPC-A barcode in seconds — no signup, no watermark. Free for casual use; paid plans from $9/mo for higher volume.