Skip to content
Barcode Generator
02 · Tips

How to calculate a barcode check digit for EAN-13, UPC-A and ITF-14

Updated October 12, 2026 · 8-minute read · 7 sections

You have twelve digits for a product and a barcode that wants thirteen. To calculate a barcode check digit for EAN-13, UPC-A, EAN-8, ITF-14 or SSCC you use the same rule every time: weight the digits 3, 1, 3, 1 from the right, add them up, and take whatever is needed to reach the next multiple of ten.

The check digit is not a secret code and not a serial number. It is a safeguard that lets a scanner reject a misread, and a till reject a mistyped number. Calculate it, never guess it.

How to calculate a barcode check digit (GS1 mod 10)

The method is the same for every GS1 number, whatever its length. It is described for EAN-13 on Wikipedia and used for the UPC-A, GTIN-14 and SSCC forms as well.

  1. Write the body: the number without its check digit. That is 7 digits for EAN-8, 11 for UPC-A, 12 for EAN-13, 13 for ITF-14 or GTIN-14, and 17 for SSCC.
  2. Start at the rightmost digit of the body and give it weight 3. Move left and alternate: 1, 3, 1, 3 and so on.
  3. Multiply each digit by its weight and add the products.
  4. The check digit is the amount that brings the sum up to the next multiple of 10. As a formula it is (10 − sum mod 10) mod 10, so a sum already ending in 0 gives check digit 0.
check = (10 − (sum mod 10)) mod 10    where the rightmost body digit has weight 3

Counting from the right is the point that trips people up. Counting from the left gives the right answer for some lengths and the wrong one for others, because the body length changes which end gets the 3. Starting at the right works for all of them.

The twelve digits of 590123456789 with weights 1 and 3 alternating, products, a sum of 127 and a check digit of 3
Weights for the EAN-13 body 590123456789: the rightmost digit gets 3, so the leftmost gets 1.

Three worked examples

EAN-13: body 590123456789

Weights and products, left to right
Digit590123456789
Weight131313131313
Product5270329415621827

The products add up to 127. The next multiple of ten is 130, so the check digit is 3 and the full number is 5901234567893.

UPC-A: body 03600029145

Eleven digits, so the leftmost one gets weight 3: 0×3 + 3×1 + 6×3 + 0×1 + 0×3 + 0×1 + 2×3 + 9×1 + 1×3 + 4×1 + 5×3 = 58. Next multiple of ten is 60, check digit 2, full number 036000291452. As an EAN-13 the same product is 0036000291452. The leading zero adds nothing to the sum and the weights line up, which is why a UPC-A is an EAN-13 with a zero in front (UPC summary).

ITF-14: body 1234567890123

Thirteen digits, leftmost weight 3: 1×3 + 2×1 + 3×3 + 4×1 + 5×3 + 6×1 + 7×3 + 8×1 + 9×3 + 0×1 + 1×3 + 2×1 + 3×3 = 109. The next multiple of ten is 110, so the check digit is 1 and the carton number is 12345678901231.

More control cases
TypeBodySumCheckFull number
EAN-134006381333938914006381333931
EAN-8963850786496385074
ISBN-139780306406159379780306406157
SSCC-18000123456789012341073000123456789012343

What the check digit catches, and what it slips past

The weights 1 and 3 share no factor with 10, so changing any single digit always changes the sum by an amount that is not a multiple of ten. Every single-digit typo is caught. Swapping two neighbouring digits changes the sum by twice their difference, so it passes unnoticed only when the two digits differ by exactly 5. That is why EAN-13 catches around 90 % of transpositions rather than all of them.

A concrete miss: 4006381333931 is valid. Swap the neighbours 3 and 8 and you get 4006831333931, which is also valid, with the same check digit. The checker would accept both. Run a test scan and compare the decoded number against your source list, because the check digit cannot protect you from that swap.

Fixing a wrong last digit

Suppose you have 4006381333932. The body gives 1, so the printed 2 is wrong. The barcode generator says "should be 1, not 2", shows the corrected number 4006381333931 and puts a button next to it that applies the fix. Before you accept it, remember there are two ways to be wrong: the last digit was mistyped, or an earlier digit was mistyped and the last one happens to be the true check digit. Compare the body against your GS1 certificate or your product sheet. Only fix the digit if the body is confirmed.

Likewise, UPC-A 036000291453 should end in 2, ITF-14 12345678901230 should end in 1, and EAN-8 96385075 should end in 4. In the batch tab, a list with many such numbers gets a report with one line per problem and a single button that corrects all the check digits, which is only safe after you have checked the bodies.

The Check digit tab of the generator does the sum in the open: it lists each digit with its weight and product, shows the total and the next multiple of ten, and accepts GTIN-8, 12, 13, 14 and SSCC-18 numbers, with or without the check digit.

UPC-E: expand to UPC-A first

UPC-E is a zero-suppressed UPC-A. Its check digit belongs to the expanded 12-digit number, not to the six digits you see. The sixth digit decides how the zeros come back; number system must be 0 or 1.

UPC-E expansion by last of the six digits (d1 d2 d3 d4 d5 d6)
d6ManufacturerProduct
0, 1, 2d1 d2 d6 0 00 0 d3 d4 d5
3d1 d2 d3 0 00 0 0 d4 d5
4d1 d2 d3 d4 00 0 0 0 d5
5 to 9d1 d2 d3 d4 d50 0 0 0 d6

Example: UPC-E 04252614 has number system 0, six digits 425261 and check 4. The last of the six is 1, so the manufacturer is 42 + 1 + 00 = 42100 and the product is 00 + 526 = 00526. The UPC-A is 0 42100 00526 4, or 042100005264. Check: the body 04210000526 sums to 46, which gives 4. A second case: 01234565 expands to 012345000065. The Check digit tab converts in both directions, and tells you when a UPC-A has too few zeros to be compressed.

Code 128 and Code 39 use different checks

Code 128 has a built-in mod 103 check symbol: start value plus the sum of each symbol's value times its position, divided by 103, with the remainder as the check symbol (Code 128). For PJJ123C in set B: 104 + 1×48 + 2×42 + 3×42 + 4×17 + 5×18 + 6×19 + 7×35 = 879, and 879 mod 103 = 55. In set A the start value is 103, so the result is 54. For 12345678 in set C the sum is 105 + 12×1 + 34×2 + 56×3 + 78×4 = 665, remainder 47. The generator uses sets B and C: it starts in set C for four or more leading digits and switches to C for four or more digits at the end or six or more in the middle.

Scanners verify and strip the Code 128 check symbol automatically, so you never type it. Code 39 has an optional mod 43 check character: add the values of the characters (0–9 then A–Z, then six symbols) and take the remainder mod 43. For CODE39 the sum is 75, remainder 32, which is the character W. Switch it on only if the receiving system expects it. Code 93 always carries two check characters, C and K, both mod 47: C weights the data characters 1 to 20 from the right, K weights the data plus C 1 to 15. For TEST93 the generator computes C = 41 (the character +) and K = 6, and adds them for you.

Mistakes I see again and again

  • Weighting from the left. It works for one length and fails for another.
  • Putting the existing check digit into the sum when verifying. Verify by recalculating from the body and comparing, or by weighting all digits with the last as 1: the total must end in 0.
  • Losing a leading zero. A spreadsheet that treats 036000291452 as a number turns it into 36000291452. Format the column as text before pasting.
  • Using an 11-digit body for EAN-13 or a 12-digit one for UPC-A. The body length decides the type.
  • Typing a plausible last digit instead of calculating it. A tool that accepts any last digit is printing a code that will not scan.

Once the digits are right, size and placement decide whether the code scans; see barcode size for printing. If you are not yet sure that EAN or UPC is the right symbol at all, which barcode type do I need sorts that out first.

The check digit proves the number is internally consistent, not that it belongs to you. Retail EAN and UPC numbers are issued by your GS1 member organisation. This is general information, not legal advice.

Questions and answers

How do I calculate the check digit for EAN-13?

Weight the 12 body digits 3, 1, 3, 1 starting from the rightmost one, add the products, and take the amount needed to reach the next multiple of 10. For 590123456789 the sum is 127, so the check digit is 3.

Is the check digit calculated the same way for UPC-A?

Yes. A UPC-A body has 11 digits and the rightmost digit still gets weight 3. For 03600029145 the sum is 58 and the check digit is 2.

What if my last digit is wrong?

Recalculate from the body. If the body is right, replace the last digit; if you are unsure of the body, compare it with your GS1 certificate or product sheet first.

Does the check digit catch every typing mistake?

It catches every single-digit error, but misses a swap of two neighbouring digits that differ by 5, so run a test scan and compare the decoded number.

Use the barcode generator now

More tips