Published Nov 21, 2026· Updated Nov 24, 2026
# EAN-13 Check Digit: How to Calculate It, Validate It, and Where It Fails
The EAN-13 check digit is the thirteenth digit of a GTIN-13. Take the first twelve digits, multiply the odd-position digits by 1 and the even-position digits by 3, add the results, and the check digit is (10 − sum mod 10) mod 10. For 400638133396 the weighted sum is 98, 98 mod 10 is 8, so the check digit is 2 and the complete code is 4006381333962. It catches every single mistyped digit, but as our own enumeration below shows, it misses entire classes of keying errors. Our free EAN-13 generator computes this digit automatically.
Calculating the EAN-13 Check Digit Step by Step
GS1 defines the rule in its General Specifications; the symbology itself is standardised as ISO/IEC 15420. Worked example for the twelve data digits 400638133396:
| Step | Operation | Result |
|---|---|---|
| 1 | Digits in odd positions (1, 3, 5, 7, 9, 11) × 1 | 4 + 0 + 3 + 1 + 3 + 9 = 20 |
| 2 | Digits in even positions (2, 4, 6, 8, 10, 12) × 3 | (0 + 6 + 8 + 3 + 3 + 6) × 3 = 26 × 3 = 78 |
| 3 | Add both groups | 20 + 78 = 98 |
| 4 | Take the sum modulo 10 | 98 mod 10 = 8 |
| 5 | Subtract from 10, then modulo 10 again | (10 − 8) mod 10 = 2 |
The finished code is 4006381333962. The second modulo step matters: when the sum already ends in 0 the check digit is 0, not 10. Position numbering starts at the leftmost digit, which is what makes the "odd × 1, even × 3" phrasing correct for a 12-digit data body only — see the cross-format section below for the version that works for every length.
If you would rather not do arithmetic by hand, enter the twelve digits in the generator and it appends the correct digit, then exports the symbol with guard bars and quiet zones to PNG, SVG or PDF for your label printer. The tool's built-in example is 590123412345, which resolves to 5901234123457.
What the Check Digit Catches — and What It Never Catches
Marketing copy usually claims the check digit "detects most errors". We tested that claim instead of repeating it: we enumerated every single-digit substitution and every two-position transposition, recomputing a valid check digit for each constructed code and asking whether the corrupted code still passes validation.
| Error you actually make | Cases tested | Detected | Undetected |
|---|---|---|---|
| One digit keyed wrong (any of 13 positions) | 117 | 117 (100%) | 0 |
| Two neighbouring digits swapped | 990 | 880 (88.89%) | 110 |
| Two digits swapped with one digit between them | 2,700 | 0 (0%) | 2,700 |
| Any two positions swapped (66 position pairs) | 5,940 | 2,880 (48.48%) | 3,060 |
The pattern follows directly from the weights. A single wrong digit changes the weighted sum by weight × difference; because the weights 1 and 3 are both coprime with 10, that can never be a multiple of 10 — so 100% of single-digit errors are caught. A swap is invisible exactly when (difference) × (weight_i − weight_j) is a multiple of 10. Neighbouring positions have weights 1 and 3, so the difference of weights is 2 and only digit pairs that differ by 5 slip through — which is why the 110 misses all have a |difference| of 5. Positions two, four or six apart carry the same weight, so their swaps change nothing at all.
Concrete example from the enumeration: 4006381333962 and 4006331833962 differ only by a swap at positions 6 and 8, and both pass check-digit validation. A scanner will happily accept either. Practical consequence: never retype a product number from memory or from a screenshot without reading the digits back in order — the checksum is not a safety net for that class of mistake.
Validating an EAN-13 You Already Have
To check a printed or supplied 13-digit code:
- Confirm it is exactly 13 characters, all digits, and that the human-readable number matches the bars if you can re-scan it.
- Recompute the check digit over the first twelve digits with the formula above and compare it with the thirteenth.
- Look up the leading digits in the GS1 prefix allocation to see which GS1 member organisation issued the company prefix.
- For authenticity — as opposed to arithmetic validity — query GS1's GEPIR database, which returns the brand owner that registered the GTIN. A correct check digit proves only that the number is well formed, never that the product is genuine or that the code is registered.
On this site the barcode generator hub validates input shape: EAN-13 expects 12 digits, EAN-8 expects 7, UPC-A expects 11 and ITF-14 expects 13, and anything that does not fit the format is refused rather than silently encoded. Encoding runs entirely in your browser, so a product number you type is never uploaded — useful when you are checking codes from a supplier list before printing barcode labels.
The Same Rule for EAN-8, UPC-A, ITF-14 and GTIN-14
The formulation "odd positions × 1, even positions × 3" breaks for other lengths, because the number of data digits changes. The portable GS1 rule is: start at the digit immediately left of the check digit and apply weights 3, 1, 3, 1… moving left. We computed the check digit for one example of each length:
| Format | Total digits | Data digits | Weight of leftmost digit | Worked example |
|---|---|---|---|---|
| EAN-8 (GTIN-8) | 8 | 7 | 3 | 9638507 → check 4 → 96385074 |
| UPC-A (GTIN-12) | 12 | 11 | 3 | 03600029145 → check 2 → 036000291452 |
| EAN-13 (GTIN-13) | 13 | 12 | 1 | 400638133396 → check 2 → 4006381333962 |
| ITF-14 (GTIN-14) | 14 | 13 | 3 | 1061414100001 → check 9 → 10614141000019 |
That single table also answers the most common structural question: EAN-13 and UPC-A share one algorithm, and a UPC-A becomes a GTIN-13 by adding a leading zero, so EAN-13 vs UPC-A is a presentation difference, not a mathematical one. For logistics cartons the same mod-10 family continues at ITF-14, and compact packs use EAN-8.
"EAN-128" Is Not a Longer EAN-13
In our own Search Console data, queries mixing "EAN" and "128" (ean 128, ean-128, ean 13) brought our pages hundreds of impressions in the last 28 days at positions 20–80, so the confusion is measurable. EAN-128 is the retired name of GS1-128, a Code 128 based carrier for Application Identifiers such as batch, expiry and serial numbers. It has no thirteenth digit at all: its check character is part of the Code 128 symbol checksum, computed with weights increasing 1, 2, 3… from the right, and it is a symbol character rather than a printed digit. If your data needs more than a product number, use the Code 128 generator and read the Code 128 structure guide; the decision table in EAN-13 vs Code 128 covers which retail and logistics systems accept which.
Five Mistakes That Survive Validation
- Retyping a number and swapping two digits of the same weight class, as in the example above: 0% detected.
- Assuming a valid checksum means a registered or genuine product; it does not, and marketplaces increasingly check GS1 registration records instead.
- Reading the leading digits as country of origin. They record where the company prefix was issued, not where the item was made — see the EAN-13 structure guide.
- Mixing formats inside one numbering system, for example a UPC-A printed on a pack and a zero-prefixed EAN-13 in the catalogue; the numbers differ on screen and are identical in the database.
- Choosing a retail GTIN for internal SKU work, where a non-registered code and a Code 39 or Code 128 symbology avoid paying for GS1 numberspace. All formats and their check-digit rules are compared in the symbology overview.