The check digit is the last digit of an EAN or GTIN number. It is not chosen at random but calculated from the other digits using a fixed formula. If a typo creeps in when the number is copied, the calculation no longer matches and the system knows at once that the number is wrong. That is why Google and comparison sites reject an invalid EAN.
What a check digit is
It is like a control total on a till receipt: if someone changes one item when copying it, the total stops adding up. A check digit does the same for a number – it catches most common typos, for example one wrong digit or most swaps of two neighbouring digits.
IBANs and payment card numbers have a check digit too, each with its own formula. In feeds it is almost always a GTIN, that is, EAN, UPC and ITF-14.
How it is calculated
Here is the procedure for EAN-13, using the first 12 digits 858123456789:
- Multiply the digits in odd positions from the left (1st, 3rd, 5th …) by 1, and those in even positions by 3.
- Add up the results.
- The check digit is the number needed to reach the next multiple of ten.
| Digit | 8 | 5 | 8 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 |
| Product | 8 | 15 | 8 | 3 | 2 | 9 | 4 | 15 | 6 | 21 | 8 | 27 |
The sum is 126. To reach 130 you need 4, so the check digit is 4 and the full EAN is 8581234567894. If the sum comes out as an exact multiple of ten, the check digit is 0.
For other GTIN lengths (8, 12, 14 digits) the same rule applies, only the weights are counted from the right: the digit right next to the check digit has weight 3, the next 1, and so on.
What it is used for
- Google Merchant Center rejects or restricts products with an invalid GTIN.
- Comparison sites and marketplaces match offers by EAN – a faulty number leads to no match or to the wrong product page.
What to watch out for
- A valid check digit does not mean the right product – a number can be valid but belong to different goods.
- Shortened numbers – Excel removes leading zeros and turns a valid number into an invalid one.
- Adding a check digit to an incomplete code – this gives a valid-looking but invented number. GTINs are assigned by the manufacturer.
- Spaces and hyphens – they have to be removed before checking.
How Sortyra helps
In rules you can use the condition is a valid EAN or is an invalid EAN and fix or leave out products with a faulty number. Only a GTIN with a valid check digit goes into outputs for Google and Heureka, and Product matching suggests a missing EAN only with a valid check digit and a stated source.
Related terms
- EAN
- GTIN
- Product identifier
- Shared EAN
- In more detail: EAN, GTIN, MPN, product code and The most common feed errors
Frequently asked questions
How do I check whether an EAN is valid?
Recalculate the check digit using the procedure above. If the result matches the last digit, the number is formally valid.
Can I create my own EAN with a check digit?
No. You will get a valid-looking number, but it is not assigned to your product, and channels may link it to someone else's goods.
Why does Google report an invalid GTIN even though I copied it from the packaging?
Most often a leading zero was lost or a typo crept in. Check the number of digits and the check digit.