Check digit
EAN check digit calculator: formula, example and Excel
The last digit of every EAN is not part of the item number – it is a check digit. It lets scanners and inventory systems catch typos and swapped digits. Here is how it is calculated: by hand, in Excel and automatically in the Barcode Generator.
Fastest way: enter the first 12 digits in the Barcode Generator – the check digit appears instantly, together with the finished barcode.
Calculate the check digitThe short version
- Multiply the digits from right to left alternately by 3 and 1 (the rightmost digit by 3).
- Add all results.
- The check digit is the difference to the next multiple of ten (0 if the sum already is one).
Or simply enter the number without check digit in the Barcode Generator – it is added automatically.
The formula
All GTINs – EAN-13, EAN-8, UPC-A and ITF-14 – use the same method (modulo 10 with weights 3 and 1):
check digit = (10 − (Σ digit × weight) mod 10) mod 10
weight = 3, 1, 3, 1, … (starting from the right, excluding the check digit)
For an EAN-13, read from the left: 1st digit × 1, 2nd digit × 3, 3rd digit × 1 and so on. The alternating weights make sure that swapped neighboring digits – a very common typo – are detected too.
Worked example
We want the check digit for 400638133393:
| Digit | 4 | 0 | 0 | 6 | 3 | 8 | 1 | 3 | 3 | 3 | 9 | 3 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 |
| Product | 4 | 0 | 0 | 18 | 3 | 24 | 1 | 9 | 3 | 9 | 9 | 9 |
Sum: 4 + 0 + 0 + 18 + 3 + 24 + 1 + 9 + 3 + 9 + 9 + 9 = 89. The next multiple of ten is 90, so the check digit is 1. The complete EAN is 4006381333931.
Calculating it in Excel
With the 12-digit number in cell A1 (formatted as text so leading zeros are kept), this formula returns the check digit:
=MOD(10-MOD(SUMPRODUCT(MID(A1,ROW($1:$12),1)*(1+2*MOD(ROW($1:$12)+1,2))),10),10)
If the formula is in B1, =A1&B1 gives the complete EAN. For EAN-8 (7 digits) replace $1:$12 with $1:$7 and MOD(ROW($1:$7)+1,2) with MOD(ROW($1:$7),2) – there the first digit gets weight 3. The same formula works in Google Sheets.
Whole lists at once: paste numbers without check digits – the generator adds them and creates all barcodes as ZIP or label sheet.
EAN-8, UPC-A, ITF-14 and ISBN
| Code | Digits without check digit | Method |
|---|---|---|
| EAN-13 / GTIN-13 | 12 | Modulo 10, weights 1-3 from the left |
| EAN-8 / GTIN-8 | 7 | Modulo 10, weights 3-1 from the left |
| UPC-A / GTIN-12 | 11 | Modulo 10, weights 3-1 from the left |
| ITF-14 / GTIN-14 | 13 | Modulo 10, weights 3-1 from the left |
| ISBN-13 | 12 | same as EAN-13 |
| ISBN-10 (old) | 9 | Modulo 11, weights 10 down to 2; a remainder of 10 is written as “X” |
| Code 128, GS1-128 | – | Modulo 103 check character, hidden in the barcode and generated automatically |
The rule “start with 3 from the right” works for every GTIN length – that is why it is easier to remember than the left-to-right version.
Verifying an existing EAN
To check a complete EAN, recalculate the check digit from the first 12 digits and compare it with the last one. The Barcode Generator does it for you: enter all 13 digits and you get either “Check digit is correct ✓” or the correct digit.
Note: a correct check digit only means the number is formally valid. Whether it is assigned to a company and which product it stands for is only shown in GS1’s database (e.g. via “Verified by GS1”).
Calculate check digits automatically
Enter 12 digits and get the check digit and barcode instantly. Also for EAN-8, UPC-A, ITF-14 and whole lists – free and with no upload.
Frequently asked questions
How do you calculate the check digit of an EAN-13?
Multiply the first 12 digits alternately by 1 and 3 (starting with 1), add the products and take the difference to the next multiple of ten. If the sum is divisible by 10, the check digit is 0.
What is the check digit for?
It detects reading and typing errors. Almost all single-digit errors and most swapped digits produce a wrong check digit, so scanners or software reject the number.
Can the check digit be 0?
Yes, whenever the weighted sum is already divisible by 10.
Does the Barcode Generator calculate the check digit automatically?
Yes. For EAN-13, EAN-8, UPC-A, ITF-14 and ISBN the number without check digit is enough – also for whole lists and sequences.
Is the formula the same for ISBN?
For ISBN-13 yes, it is an EAN-13. The old ISBN-10 uses a different method (modulo 11) and can have an “X” as check digit.
Is an EAN with a correct check digit automatically valid?
Only formally. Whether the number has been assigned to a company is shown in the GS1 database.
Sources
- How to calculate a check digit manually, GS1.
- GS1 General Specifications, GS1 – rules for symbol sizes, quiet zones and application identifiers.