How the EAN-13 check digit works

The 13th digit of every EAN-13 barcode is not chosen — it is calculated. Here is the formula, a full worked example, and why it matters.

EAN Studio · Updated July 2026

An EAN-13 barcode encodes thirteen digits. The first twelve identify the product (a GS1 prefix, a company prefix and an item reference); the thirteenth is a check digit — a single digit computed from the other twelve. Its only job is to catch errors: if one digit is mistyped or misread, the check digit no longer matches and the scan is rejected.

The formula, in plain terms

Reading the twelve data digits from left to right:

  1. Multiply the digits in odd positions (1st, 3rd, 5th …) by 1.
  2. Multiply the digits in even positions (2nd, 4th, 6th …) by 3.
  3. Add all the results together to get a sum.
  4. The check digit is whatever you must add to that sum to reach the next multiple of ten. In formula terms: check = (10 − (sum mod 10)) mod 10.

That final "mod 10" matters for one edge case: if the sum is already a multiple of ten, the check digit is 0, not 10.

A worked example

Take the twelve data digits 400638133393. Lay them out with their weights:

Digit400638133393
Weight131313131313
Product40018324193999

The products add up to 4 + 0 + 0 + 18 + 3 + 24 + 1 + 9 + 3 + 9 + 9 + 9 = 89. The next multiple of ten above 89 is 90, and 90 − 89 = 1. So the check digit is 1, and the complete EAN-13 is 4006381333931.

Don't want to do it by hand? The check digit calculator does this instantly for EAN-13, UPC-A, EAN-8 and GTIN-14, and the EAN-13 generator adds the check digit automatically when you create the barcode.

Why scanners rely on it

When a scanner reads an EAN-13, it repeats exactly this calculation on the first twelve digits and compares the result to the thirteenth. If they disagree, the read is discarded. This single extra digit catches the overwhelming majority of single-digit typos and many transposition errors — cheap insurance against scanning the wrong product at a checkout.

The same maths powers UPC, EAN-8 and GTIN-14

The EAN-13 method is really the GS1 modulo-10 algorithm, and it is shared across the family: UPC-A (11 data digits), EAN-8 (7 data digits) and GTIN-14 / ITF-14 (13 data digits) all use the same alternating weights of 3 and 1 from the right. Only the length changes; the logic is identical.

The check digit is not the whole number. Calculating it does not create a registered product number. For retail sale, the GTIN behind an EAN-13 is assigned by GS1. This maths only completes and validates a number you already have.

Calculate or generate it now

Skip the arithmetic — get the check digit and the full number in your browser.

Open the check digit calculator

Frequently asked questions

What is the EAN-13 check digit?

It is the 13th and final digit of an EAN-13 barcode, calculated from the first twelve. Scanners recompute it on every read to catch a mistyped or misread number.

How do you calculate the EAN-13 check digit?

Multiply the twelve data digits by alternating weights of 1 and 3 (the first digit by 1), add the products, then the check digit is the number needed to reach the next multiple of ten.

Does the same formula apply to UPC-A and EAN-8?

Yes. UPC-A, EAN-8 and GTIN-14 all use the same GS1 modulo-10 algorithm; only the number of data digits changes.

What happens if the check digit is wrong?

A scanner recalculates the check digit and rejects the read if it does not match, so an invalid or mistyped number simply will not scan as a valid product.