UPC check digit calculator
The last digit of a retail barcode number carries no information about the product. It is arithmetic. Weight the digits alternately by three and one from the right, add them up, and take whatever is needed to reach the next multiple of ten: for the eleven digits 03600029145 the sum comes to 58, the next multiple of ten is 60, and the check digit is therefore 2, giving the UPC-A 036000291452. Everything below is about the places where that sum is taken over something other than the digits in front of you.
Where it is used
- Checking a GTIN off a supplier price list before it goes into the catalogue, where a wrong digit does not surface until a till refuses it months later
- Completing a number read from a packaging proof or an old carton, when the last digit is the one the crease or the scuff is hiding
- Verifying ISBN-13 numbers against a print run, since a book barcode is an EAN-13 with 978 or 979 in front and the same modulo 10 behind it
- Working out whether a number typed off a photograph is a genuine misread or a genuinely different product
How it compares
All six code types here run the same GS1 modulo 10 and differ only in how many digits go into the sum: seven for EAN-8, eleven for UPC-A, twelve for EAN-13 and ISBN-13, thirteen for ITF-14. UPC-E is the exception, and the one that catches people out — its seven digits are expanded to eleven before anything is added up. ISBN-10 is a different algorithm altogether: modulo 11 with weights running from ten down to two, and a check character that can come out as the letter X, which is why an ISBN-10 cannot be promoted to an ISBN-13 by keeping its last character. You drop that character, put 978 in front, and recompute. Code 128 carries a check character too, but its encoder computes it inside the symbol and it never appears in the number a person types. Code 39 is a separate case: its mod-43 check character is optional, this generator leaves it out, and when a receiving system expects one you work it out yourself over the 43-character alphabet. Neither is business for this page.
Common mistakes
- Running modulo 10 straight over a UPC-E. The seven digits 0425261 expand to the eleven digits 04210000526 first, and only then get weighted; skip the expansion and you get 0 where the correct digit is 4. The expansion rule is chosen by the last of the seven digits, which is why UPC-E numbers ending in 3 and in 7 unpack to different shapes.
- Losing a leading zero on the way out of a spreadsheet. Excel and Numbers drop it from a numeric cell without comment, and the digit computed over the shortened number is correct arithmetic performed on the wrong number. Format the column as text before the numbers arrive in it, not after.
- Reading a valid check digit as proof that the number is real. It is a typo detector and nothing more — not a signature, not a checksum anyone signed, and no evidence that GS1 ever issued the prefix to anybody. Any twelve digits you invent will accept a thirteenth quite happily.
Frequently asked questions
- How is the check digit calculated?
- Take the digits without the check digit and weight them alternately by three and one, starting with three at the right-hand end. Add the results. The check digit is whatever brings that total up to the next multiple of ten, and zero if the total already is one. For the twelve digits 460123456789 the weighted sum is 117, the next multiple of ten is 120, and the check digit is 3.
- Why does UPC-E need to be expanded first?
- Because UPC-E is not a short number, it is a UPC-A with runs of zeros squeezed out, and the check digit belongs to the full twelve-digit form. The last of the seven digits says how to put the zeros back: 0, 1 and 2 rebuild one shape, 3 and 4 have rules of their own, and 5 through 9 push four zeros in before the final digit. The calculator expands the number and then weights it, which is what the standard requires and what a scanner in a shop will do.
- Which mistakes does the check digit actually catch?
- Every single mistyped digit, without exception. Most swaps of two neighbouring digits, but not all of them: because the weights differ by two, a swap of two adjacent digits that are five apart leaves the total unchanged modulo ten. 4607000012383 and 4607000012833 are both arithmetically valid, and they are different products. That is the practical limit of what one digit can do.
- How do I turn an ISBN-10 into an ISBN-13?
- Throw away the last character of the ISBN-10 — including an X, which has no place in a barcode number — put 978 in front of the nine digits that remain, and compute a fresh check digit over the twelve. The old check character is not reusable because ISBN-10 is modulo 11 and ISBN-13 is modulo 10; the two algorithms agree only by coincidence.
- Can I get a barcode image from here?
- Not on this page. The calculator only handles the number. Once you have the full number, the generator for that code type will draw it as SVG, PNG or PDF — the links under the calculator go straight to the right one.