EAN Check Digit Explained, with a Free Calculator

How the 13th digit of an EAN is calculated, how to validate any GTIN in seconds, and why a correct check digit says nothing about who owns a code.

In short

  • The check digit is the last digit of an EAN-13 and is calculated from the first 12 digits.
  • Multiply the digits alternately by 1 and 3 from the left, add them up, and take the amount needed to reach the next multiple of 10.
  • For GTIN-8, UPC-A and GTIN-14 the weights start from the right: the digit next to the check digit always counts three times.
  • The check digit catches every single wrong digit and most swapped digits, but not swaps of digits that differ by 5.
  • A valid check digit only proves the format; it says nothing about registration, ownership or uniqueness.

The EAN check digit is the 13th and last digit of an EAN-13 barcode number, and it is calculated from the first 12 digits so that scanners and software can spot typing and reading errors. To calculate it, multiply the first 12 digits alternately by 1 and 3 (starting with 1 on the left), add up the results, and take the amount needed to reach the next multiple of 10: that number, from 0 to 9, is the check digit.

That is the whole method, and it is the same one GS1 publishes for every GTIN length. This guide walks through it step by step with fully worked examples, shows how the weights change for GTIN-8, UPC-A (GTIN-12) and GTIN-14, explains which mistakes the check digit catches and which ones slip through, and gives you spreadsheet formulas you can paste straight into Excel or Google Sheets. You can also use the free calculator below to calculate or validate a code in a second.

One point before we start, because it causes a lot of confusion: a correct check digit tells you that a number is well-formed. It does not tell you that the number was issued to anyone, that it is unique, or that it belongs to you. We come back to that in detail further down.

Type the first 12 digits to get the 13th, or all 13 to check a code.
Type at least 12 digits.

What is an EAN check digit and why does it exist?

An EAN-13 (also called GTIN-13, the 13-digit Global Trade Item Number) is made up of a GS1 Company Prefix, an item reference and one check digit at the end. The prefix and item reference together identify the product. The check digit adds no information about the product at all. Its only job is to protect the other 12 digits against mistakes.

Think about how often product numbers get copied by hand or by machine: a seller types the code into a marketplace upload sheet, a warehouse worker keys it into stock software when a label will not scan, a feed tool converts a spreadsheet column, a scanner reads a barcode on a crumpled bag. Every one of those steps can introduce an error. Without a check digit, a wrong number would look exactly as plausible as the right one, and the error would only surface when the wrong product turned up in an order.

With a check digit, the receiving system can recalculate the last digit from the first 12 and compare. If they do not match, the number is rejected straight away. Checkout scanners do this on every beep, which is why a damaged barcode usually fails to scan rather than ringing up the wrong product. Marketplace and feed validators do the same with numbers you upload. Google, for example, asks merchants to make sure the check digit is valid and points to GS1's calculator to verify it.

Where the check digit sits in the code

For the EAN-13 number 8712345678906, the parts are:

  • 871234567890: the first 12 digits, which contain the GS1 Company Prefix (7 to 10 digits, starting with a 2 or 3 digit GS1 prefix) and the item reference.
  • 6: the check digit, calculated from those 12 digits.

This number is used throughout this article purely to illustrate the arithmetic. It is not a real product. If you want to understand what the prefix and item reference mean, and why the first digits do not reveal where a product was made, read our complete guide to EAN codes.

How to calculate an EAN-13 check digit, step by step

GS1, the organisation that maintains the GTIN standard, describes the calculation as a modulo-10 method with weights of 1 and 3 (GS1: how to calculate a check digit manually). "Modulo 10" simply means you only care about the remainder after dividing by 10, which is the last digit of the sum. Here are the steps for an EAN-13.

  1. Write down the first 12 digits. Leave out the check digit if you already have one, or start from the 12 digits you want to complete.
  2. Give each digit a weight. Starting from the left, the 1st digit gets weight 1, the 2nd gets weight 3, the 3rd gets weight 1, and so on, alternating. Odd positions get 1, even positions get 3.
  3. Multiply each digit by its weight. You end up with 12 products.
  4. Add the 12 products together.
  5. Find the next multiple of 10. Round the sum up to the nearest multiple of 10 (if the sum already ends in 0, it is already a multiple of 10).
  6. Subtract. The next multiple of 10 minus the sum is the check digit. If the sum already ends in 0, the check digit is 0.

A shortcut that gives the same answer: take the last digit of the sum and subtract it from 10. If the result is 10, the check digit is 0. Written as a formula: check digit = (10 − (sum mod 10)) mod 10.

Quick memory aid: for an EAN-13, the digits in positions 2, 4, 6, 8, 10 and 12 (the ones directly to the left of the check digit and every second digit before it) are the ones multiplied by 3. Everything else counts once.

Worked examples: EAN-13 check digits calculated in full

The fastest way to trust the method is to see it work on a few numbers. Each example below has been calculated and double-checked.

Example 1: 871234567890 becomes 8712345678906

PositionDigitWeightProduct
18×18
27×321
31×11
42×36
53×13
64×312
75×15
86×318
97×17
108×324
119×19
120×30
Sum114

The next multiple of 10 after 114 is 120, and 120 − 114 = 6. The check digit is 6, so the full EAN-13 is 8712345678906.

Example 2: GS1's own example, 629104150021 becomes 6291041500213

GS1 uses this number on its manual calculation page. The digits 6 2 9 1 0 4 1 5 0 0 2 1, weighted 1, 3, 1, 3 and so on, give the products 6, 6, 9, 3, 0, 12, 1, 15, 0, 0, 2 and 3. Their sum is 57. The next multiple of 10 is 60, and 60 − 57 = 3. The full number is 6291041500213.

Notice the 2 in position 11 and the 1 in position 12: the 2 is multiplied by 1 and the 1 is multiplied by 3. Getting those two the wrong way round is the most common reason a hand calculation goes wrong.

Example 3: a sample code from a Kaufland listing guide, 4006381333931

A Kaufland listing guide 4006381333931 as its sample EAN published by wisepim. Let us confirm the last digit. The first 12 digits are 4 0 0 6 3 8 1 3 3 3 9 3.

  • Odd positions (weight 1): 4 + 0 + 3 + 1 + 3 + 9 = 20
  • Even positions (weight 3): (0 + 6 + 8 + 3 + 3 + 3) × 3 = 23 × 3 = 69
  • Sum: 20 + 69 = 89
  • Next multiple of 10: 90, so the check digit is 90 − 89 = 1

The code ends in 1, so it is valid. This example also shows a handy shortcut for mental arithmetic: add up the odd positions, add up the even positions, multiply the even total by 3 once, and add the two totals. That is the same calculation with fewer multiplications.

Example 4: when the check digit is 0

Take the 12 digits 501234567890. The odd positions add up to 5 + 1 + 3 + 5 + 7 + 9 = 30. The even positions add up to 0 + 2 + 4 + 6 + 8 + 0 = 20, and 20 × 3 = 60. The total is 90, which is already a multiple of 10, so the check digit is 0 and the full number is 5012345678900. People sometimes expect the answer to be 10 in this case. It never is: a check digit is always a single digit from 0 to 9.

Example 5: an ISBN-13 uses exactly the same method

Book numbers starting with 978 or 979 are GTIN-13s in the GS1 "Bookland" range, so their last digit follows the same rule. For the sample ISBN-13 978030640615, the odd positions give 9 + 8 + 3 + 6 + 0 + 1 = 27 and the even positions give (7 + 0 + 0 + 4 + 6 + 5) × 3 = 22 × 3 = 66. The sum is 93, so the check digit is 7 and the number is 9780306406157. Remember that ISBNs come from national ISBN agencies, not from GS1 or from barcode resellers.

How to validate a complete EAN-13 in one step

When you already have all 13 digits and just want to know whether the number is valid, you do not need to calculate the check digit separately and compare. There is a quicker test.

  1. Weight all 13 digits: 1, 3, 1, 3 … from the left, which means the check digit itself gets weight 1.
  2. Add up all 13 products.
  3. If the total ends in 0 (it is a multiple of 10), the number is valid. If it ends in anything else, it is not.

For 8712345678906, the first 12 digits give 114 (as in example 1), and the check digit adds 6 × 1 = 6. The total is 120, which ends in 0, so the number passes. For 8712345678909, the total would be 114 + 9 = 123, which ends in 3, so the number fails.

This is exactly what the calculator above does when you paste in a full 13-digit code, and it is what validation scripts in marketplaces and shop systems do behind the scenes.

Check digits for GTIN-8, UPC-A (GTIN-12) and GTIN-14: weights from the right

GTINs come in four lengths: GTIN-8, GTIN-12, GTIN-13 and GTIN-14. Google's product feed accepts all four (Google Merchant Center help on GTIN). They all use the same modulo-10 calculation, but there is one rule that people get wrong when they switch between lengths: the weights are anchored on the right, not on the left.

The digit immediately to the left of the check digit always gets weight 3. Moving leftwards, the weights alternate 1, 3, 1, 3. For a GTIN-13 that happens to produce 1, 3, 1, 3 … from the left, because there are 12 digits before the check digit (an even number). For GTIN-8 and GTIN-12 there is an odd number of digits before the check digit (7 and 11), so counted from the left the pattern starts with 3. The same goes for GTIN-14, which has 13 digits before the check digit.

FormatDigits before check digitWeights counted from the leftTypical use
GTIN-8 (EAN-8)73, 1, 3, 1, 3, 1, 3Very small packs
GTIN-12 (UPC-A)113, 1, 3 … 3Products in the US and Canada
GTIN-13 (EAN-13)121, 3, 1 … 3Consumer products outside North America
GTIN-14133, 1, 3 … 3Cartons and other trade units (ITF-14, GS1-128)

One rule for every length: pad any GTIN with leading zeros to 14 digits, then weight the first 13 digits 3, 1, 3, 1 … from the left. Leading zeros add nothing to the sum, so the result is identical for GTIN-8, 12, 13 and 14. Many validation scripts work exactly this way.

GTIN-8 example: 9638507 becomes 96385074

Weights from the left are 3, 1, 3, 1, 3, 1, 3. The products are 9×3 = 27, 6×1 = 6, 3×3 = 9, 8×1 = 8, 5×3 = 15, 0×1 = 0 and 7×3 = 21. The sum is 86, the next multiple of 10 is 90, and the check digit is 4. The full GTIN-8 is 96385074.

If you had used the EAN-13 pattern by mistake (1, 3, 1 … from the left) you would get a different, wrong digit. That is the classic error with EAN-8 codes. In practice, few online sellers need an EAN-8: GS1 Netherlands only assigns one for certain small pack sizes, for example when the printable area is under 80 cm², and suggests shrinking an EAN-13 as an alternative (GS1 NL support).

UPC-A (GTIN-12) example: 03600029145 becomes 036000291452

For the 11 digits 0 3 6 0 0 0 2 9 1 4 5, the weights from the left are 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3. The odd positions are 0 + 6 + 0 + 2 + 1 + 5 = 14, times 3 is 42. The even positions are 3 + 0 + 0 + 9 + 4 = 16. The sum is 42 + 16 = 58, so the check digit is 60 − 58 = 2, giving 036000291452.

Now write the same UPC as an EAN-13 by adding a leading zero: 0036000291452. Weight the first 12 digits 1, 3, 1, 3 … from the left and you get the same sum of 58 and the same check digit, 2. This is why a UPC-A with a 0 in front is a valid GTIN-13, and why US-origin numbers start with 0 when they are written as EAN-13. The difference between these formats is covered in EAN vs UPC vs GTIN explained.

GTIN-14 example: 1871234567890 becomes 18712345678903

GTIN-14s identify trade units such as outer cartons, usually printed as an ITF-14 or GS1-128 barcode (GS1 UK on packaging levels). To show the arithmetic only, take the 13 digits 1 8 7 1 2 3 4 5 6 7 8 9 0. With weights 3, 1, 3 … from the left:

  • Odd positions (weight 3): 1 + 7 + 2 + 4 + 6 + 8 + 0 = 28, times 3 = 84
  • Even positions (weight 1): 8 + 1 + 3 + 5 + 7 + 9 = 33
  • Sum: 84 + 33 = 117, so the check digit is 120 − 117 = 3

The full number is 18712345678903. Notice that its check digit (3) differs from the EAN-13 check digit for 871234567890 (6). Changing the first digit changes the sum, so a GTIN-14 for a carton needs its own check digit. Carton GTINs are assigned by the brand owner under GS1 rules, so do not invent them for real products.

Padding an EAN-13 to 14 digits

Some systems store every GTIN in a 14-digit field. In those fields a GTIN-13 gets a leading zero: 8712345678906 becomes 08712345678906, as GS1 UK explains for 14-digit barcode fields. The check digit stays 6, because a zero at the front adds nothing to the weighted sum. Only zeros are allowed for padding. Any other leading digit creates a different number with a different check digit, as the GTIN-14 example shows.

Which errors does the check digit catch, and which does it miss?

The weights 1 and 3 were chosen so that the most common human errors change the last digit of the sum. Here is what that means in practice.

Single wrong digit: always caught

If one digit is wrong, the number always fails the check. Change the 5th digit of 8712345678906 from 3 to 8 and you get 8712845678906. The first 12 digits now sum to 119 instead of 114, so the correct check digit would be 1, not 6. The validator rejects the code. This works for any single wrong digit in any position: multiplying the difference by 1 or 3 can never produce a multiple of 10 unless the difference is zero.

Two neighbouring digits swapped: almost always caught

Transposing two adjacent digits is a very common typing error. Swap the last two digits before the check digit in 8712345678906 and you get 8712345678096. The first 12 digits (871234567809) now give a check digit of 8, not 6, so the code is rejected.

There is one blind spot. If the two swapped digits differ by exactly 5 (0 and 5, 1 and 6, 2 and 7, 3 and 8, 4 and 9), the swap is not detected. One digit moves from weight 1 to weight 3 and the other the opposite way, so the sum changes by 2 × 5 = 10, which leaves the last digit unchanged. For example, 8712345678500 and 8712345678050 are both valid EAN-13 numbers: their first 12 digits sum to 110 and 120, and both give a check digit of 0. If someone types one instead of the other, no validator will notice.

Bigger mistakes: caught most of the time, not always

When two or more digits are wrong at once, or digits are swapped further apart, the check digit catches the error in most cases but not all. Roughly speaking, a random wrong number has about a one in ten chance of happening to end in the right check digit, because there are only ten possible check digits. That is why the check digit is a safety net against small slips, not a guarantee that a number is correct.

Type of errorExampleDetected?
One wrong digit8712845678906Yes, always
Adjacent swap, digits differ by anything other than 58712345678096 (9 and 0 swapped)Yes
Adjacent swap, digits differ by 58712345678050 instead of 8712345678500No
Wrong check digit only8712345678909Yes, always
Several digits wrongAnyUsually, not always
Correct number, wrong productA valid code from another itemNo, never

The last row is the one that matters most for sellers, and it leads straight to the next section.

What a valid check digit does not prove

Online, you will find plenty of "EAN validators" that say a number is "valid" or even "verified". In almost every case, all they have done is the calculation in this article. Google itself suggests using the GS1 check digit calculator to verify a GTIN, but that is a format check. A green tick from a check digit tool tells you nothing about the following.

  • Whether the number was ever issued. About one in every ten random 13-digit strings ends in the correct check digit. Those numbers are valid in format and may never have been assigned to anyone.
  • Who the number belongs to. The check digit contains no information about the brand owner, the licence holder or the buyer.
  • Whether the number is unique. A code that has already been used for another product passes the check digit test just as easily as an unused one.
  • Whether the prefix is allowed for products. Restricted and special ranges such as 200–299 (in-store and variable-weight codes), 977 (ISSN), 978–979 (ISBN), 980 (refund receipts) and 981–983 and 99 (coupons) can all carry valid check digits (GS1 prefix list). Google Merchant Center rejects prefixes 02, 04 and 2 as restricted, and 05, 98, 99 and 981–984 as coupon ranges, even when the check digit is correct.
  • Whether a marketplace will accept it. Amazon compares product codes with GS1's data, and bol.com requires a GS1-registered EAN for branded items. A correct check digit does not get you past either rule. See EAN codes for Amazon for how that brand check works.

Format check vs registry lookup

To learn more about a number than its format, you need a registry. GS1's lookup, Verified by GS1 (gepir.gs1.org now redirects there), shows the company that licensed the number from GS1, plus any product data the licensee has uploaded (Verified by GS1). For a number that was resold, it shows the original licence holder, or no product data at all, not the company that is using it today.

GTINcodes.com runs its own, separate register. Every EAN-13 sold through our shops is a valid number from GTINcodes' stock, issued once and registered to the buyer in the GTINcodes register, and anyone can look it up on the code check page. That register shows which customer the number was issued to and when, with a protection plan, including the buyer's company name. It is not a GS1 registration and does not change what Verified by GS1 shows. If you need to prove a code is yours in a dispute, our guide to proving EAN ownership explains what kind of evidence works where.

QuestionCheck digit calculationVerified by GS1GTINcodes register
Is the number well-formed?YesYesYes
Who licensed it from GS1?NoYesNo
Who bought it from GTINcodes.com, and when?NoNoYes, for GTINcodes numbers
Is it unique to one product?NoOnly for data the licensee publishedIssued once by GTINcodes.com
Will a marketplace accept it?NoDepends on the channel's rulesDepends on the channel's rules

How to calculate EAN check digits in Excel, Google Sheets and code

If you manage dozens or hundreds of products, you will want to check codes in bulk rather than one by one. The formulas below assume the code is stored as text in cell A2, without spaces or dashes.

Spreadsheet formula: calculate the 13th digit

Put the first 12 digits in A2 and use this formula in B2:

=MOD(10-MOD(SUMPRODUCT(--MID(A2,{1,2,3,4,5,6,7,8,9,10,11,12},1),{1,3,1,3,1,3,1,3,1,3,1,3}),10),10)

It takes each of the 12 characters with MID, turns them into numbers with the double minus, multiplies them by the weights 1, 3, 1, 3 … with SUMPRODUCT, and applies the modulo-10 rule. For 871234567890 it returns 6. Then join the two with =A2&B2 to get the full 13-digit code.

Spreadsheet formula: validate a full EAN-13

Put the full 13 digits in A2:

=AND(LEN(A2)=13,MOD(SUMPRODUCT(--MID(A2,{1,2,3,4,5,6,7,8,9,10,11,12,13},1),{1,3,1,3,1,3,1,3,1,3,1,3,1}),10)=0)

This returns TRUE for 8712345678906, 6291041500213 and 4006381333931, and FALSE for 8712345678909. Check the formula on these known examples before you trust it on your own list. Spreadsheet versions and locale settings differ, and in some languages the argument separator is a semicolon instead of a comma.

Watch out for leading zeros and scientific notation

Spreadsheets are the single biggest source of broken EANs. Two things go wrong.

  • Leading zeros disappear. Type 0036000291452 into a cell formatted as a number and it becomes 36000291452, which is only 11 digits. Format the column as text before you paste codes, or type an apostrophe in front of the number.
  • Long numbers turn into scientific notation. A 13-digit number can display as 8.71235E+12. If the file is saved as CSV in that state, the real digits may be lost and replaced by zeros. Again, the fix is to treat the column as text from the start.

After any import or export, run the validation formula over the whole column. A column of FALSE values is much easier to spot than a rejection report from a marketplace a week later.

A few lines of Python for any GTIN length

Developers can use the "weights from the right" rule to handle all four lengths with one function:

def check_digit(body):
    total = sum(int(d) * (3 if i % 2 == 0 else 1) for i, d in enumerate(reversed(body)))
    return (10 - total % 10) % 10

Pass in the digits without the check digit: 7 for GTIN-8, 11 for GTIN-12, 12 for GTIN-13 or 13 for GTIN-14. Because it starts from the rightmost digit with weight 3, check_digit("871234567890") returns 6, check_digit("9638507") returns 4 and check_digit("03600029145") returns 2. To validate a full code, compare the result with its last digit. Before calling the function, strip spaces and dashes and confirm that the input contains only digits.

Shop systems that validate for you

Some platforms now run this check on entry. Shopify's API version 2026-10, announced on 8 September 2026, replaces the single variant barcode field with a list of up to 20 identifiers per variant, each typed as UPC, EAN, ISBN, GTIN or ASIN and validated against its standard (Shopify developer changelog). In practice that means a code with a wrong check digit, or a 13-digit EAN entered as a UPC, can be refused at the moment you save the product rather than later in a feed.

Common EAN validation errors in marketplaces and feeds

When a channel rejects a code as "invalid", the cause is often one of the issues below. Work through them in this order, because the first few take seconds to check.

1. The number has the wrong length

An EAN-13 has exactly 13 digits. Count them. A 12-digit number is often a UPC-A that lost its leading zero, or an EAN-13 that lost its check digit. An 11-digit number is often a UPC-A that lost its leading zero in a spreadsheet. A 14-digit number may be a padded GTIN-13 (a leading 0) or a carton-level GTIN-14 that should not be on a consumer listing.

2. A UPC in an EAN field, or the other way round

Some forms and feeds have separate fields for UPC and EAN. A 12-digit UPC-A entered in a 13-digit EAN field needs a leading zero to become a GTIN-13. A 13-digit EAN entered in a UPC field will fail outright. Putting a 13-digit EAN in a UPC field is one of the common GTIN problems sellers run into, according to the GS1 US partner site gtin.info.

3. Hidden characters

Spaces, dashes, non-breaking spaces and the letter O instead of the number 0 all break validation, and some of them are invisible in a spreadsheet. If a code looks right but fails, retype it or clean the column with a "digits only" formula before uploading.

4. The check digit really is wrong

If the length and characters are fine, recalculate the check digit with the calculator above. A wrong final digit usually means a typing error somewhere in the 13 digits, not just at the end. Go back to the source (the supplier's data, your purchase confirmation or the printed barcode) instead of "fixing" the last digit so the check passes. Changing the check digit to make an incorrect number look valid simply creates a different, wrong number.

5. Wrong weights in a homemade tool

If your own spreadsheet or script disagrees with the calculator, check the weights. Applying 3, 1, 3 … from the left to the 12 digits of an EAN-13 (the GTIN-12 pattern) gives the wrong answer: for 871234567890 it produces a sum of 126 and a check digit of 4 instead of 6. The fix is to anchor the weights on the right, as explained above.

6. Restricted or special prefixes

A number can have a perfect check digit and still be refused because of its prefix. Numbers starting with 2 (store and variable-weight codes), 977–979 (serials and books) or 98–99 (refund receipts and coupons) are not normal product GTINs, and Google's feed rules list several of these ranges as not allowed. If a supplier or a free online generator gave you such a number for an ordinary product, it is the wrong kind of code.

7. Valid, but already used for another product

Google calls this "incorrect GTIN": the format is fine, but the number belongs to a different product. Amazon has error 8542 for a product ID that already exists for a different ASIN. No check digit calculator can detect this. You need a number that has not been used before, which is where the source of your codes matters more than the arithmetic. For channel-specific fixes, see GTIN for Google Shopping.

Do not keep trying numbers until one is accepted. Uploading one code after another from a batch, or tweaking digits until a marketplace stops complaining, can look like an attempt to game the catalogue. Find out why the first code was rejected and fix that cause.

Can you make your own EAN code by calculating the check digit?

Technically, anyone can type 12 digits and add the right 13th digit. The result will pass every check digit test. But that does not make it a usable product number, and this is where many new sellers go wrong.

A GTIN only works if it is unique: one number for one product, worldwide. Retailers and marketplaces build their catalogues around that assumption. Bol.com and Kaufland, for example, create one product page per EAN and attach every seller's offer of that item to it. A made-up number may already belong to someone else's product, may be in a restricted range, or may clash with a code that is issued later. Google's guidance is direct: "Do not make up or create new GTINs" (Google Merchant Center).

The barcode image is different. Once you have a number that was properly issued to you, you can generate the EAN-13 barcode graphic yourself with free software. Shopify's German blog puts it neatly: inventing your own EANs is risky because of duplicates, but the barcode image itself can be created without any problem. For print size, colours and quiet zones, see our barcode printing guide.

Where properly issued numbers come from

There are two routes. GS1 member organisations license company prefixes and individual GTINs, usually for an annual fee. GS1 is the right choice if you sell to retail chains or supermarkets, on Zalando, or branded products on Amazon or bol.com, or if you need your company to appear in GS1's registry. Resellers such as GTINcodes.com sell individual numbers for a one-off price. Our numbers are valid EAN-13s from GTINcodes' stock, issued once and registered to you in the GTINcodes register. They are not GS1 memberships, and in Verified by GS1 they show the original licence holder or nothing, not your company. They suit unbranded products, your own webshop and channels whose rule is "a valid, unique EAN". Our honest comparison of GS1 and reseller codes sets out which fits which situation, and the prices for our codes are listed in our shops.

Leading zeros, country prefixes and 2D codes: more check digit details

The check digit in the printed barcode

The human-readable digits under an EAN-13 barcode include the check digit, so that someone can type the full number if the barcode will not scan. The check digit is also encoded in the bars, and the scanner recalculates it on every read. If you are given only 12 digits for a product, the 13th is missing and has to be calculated, but only do that when you know the 12 digits are correct and were issued for that product.

Many products share the same check digit

There are only ten possible check digits, so about one in ten of all GTINs ends in any given digit. The check digit identifies nothing on its own. Only the full 13-digit number identifies the product.

Leading zeros never change the check digit

Leading zeros add nothing to the weighted sum, so padding a UPC-A to 13 digits or an EAN-13 to 14 digits keeps the same check digit. Any other change to the digits before the check digit, including adding a 1 at the front, does change it.

The calculation is the same in every country

The method is part of the global GS1 standard and is identical everywhere. The prefix at the start of the number only shows which national GS1 office issued the company prefix. It does not show where the product was made or where the seller is based, as GS1 states explicitly, and it has no effect on how the check digit is calculated.

2D barcodes and Sunrise 2027 use the same check digit

GS1 and the retail industry aim for checkout systems worldwide to be able to read 2D codes (GS1 DataMatrix and QR codes with GS1 Digital Link) by the end of 2027. That is a readiness goal, not a mandate, and the 1D EAN/UPC barcode will stay alongside 2D codes for years. A 2D code carries the same GTIN, check digit included, so the calculation in this article stays exactly the same.

Checklist: validating an EAN before you print or list it

Run through these steps every time you add new codes to your product data, before anything goes to the printer or a marketplace.

  1. Clean the input. Remove spaces, dashes and hidden characters. Make sure your spreadsheet column is formatted as text so leading zeros survive.
  2. Check the length. 13 digits for an EAN-13, 12 for a UPC-A, 8 for a GTIN-8, 14 for a GTIN-14. Pad only with leading zeros.
  3. Validate the check digit. Use the calculator at the top of this page or the spreadsheet formula. All 13 weighted digits together must add up to a multiple of 10.
  4. Look at the prefix. Ordinary product codes should not start with 2, 977, 978, 979, 98 or 99.
  5. Check uniqueness in your own data. Sort the column and look for duplicates. Every size, colour and pack size needs its own code.
  6. Check who the code is registered to. For GS1 numbers, search Verified by GS1. For numbers bought from GTINcodes.com, use our code check page. Search the marketplace too, to make sure the number is not already attached to a different product.
  7. Match the code to the channel's rules. A valid check digit is necessary everywhere, but some channels need more. Branded products on Amazon and bol.com, Zalando and physical retail expect GS1 codes registered to the brand owner.
  8. Print a test barcode and scan it. Generate the barcode from the validated number, print it at the intended size, and scan it with a phone or a hand scanner before you order packaging or labels.

If you remember just one thing from this guide, make it this: the check digit is a typo detector. It is fast, reliable for single mistakes and built into every scanner, but it says nothing about ownership. Use it to keep your data clean, and use the right registry, and the right source of codes, for everything else. For the bigger picture on how EANs work, start with what an EAN code is, or go to the GTINcodes.com homepage to look up or register codes.

Frequently asked questions

What is the check digit of an EAN-13?

It is the 13th and final digit. It is calculated from the first 12 digits with GS1's modulo-10 method, using weights of 1 and 3. Scanners and software recalculate it to catch typing and reading errors.

Is the EAN check digit the same as the UPC check digit?

Yes, both use the same modulo-10 method with weights anchored on the right. A 12-digit UPC-A with a leading zero added becomes a GTIN-13 with exactly the same check digit.

Can the check digit of an EAN be 0?

Yes. If the weighted sum of the first 12 digits is already a multiple of 10, the check digit is 0. It can never be 10, because a check digit is always a single digit from 0 to 9.

Does a valid check digit mean an EAN is registered?

No. Around one in ten random 13-digit numbers has a correct check digit. To see who a number was issued to, you need a registry such as Verified by GS1, or the GTINcodes.com check page for numbers bought from GTINcodes.

Why does my marketplace reject an EAN with a correct check digit?

Common reasons are a restricted prefix (for example codes starting with 2, 977 to 979, 98 or 99), a number already used for a different product, or a channel rule that requires a GS1 code registered to the brand owner, as with branded products on Amazon and bol.com.

Can I calculate EAN check digits in Excel?

Yes. With the 12 digits stored as text in A2, the formula =MOD(10-MOD(SUMPRODUCT(--MID(A2,{1,2,3,4,5,6,7,8,9,10,11,12},1),{1,3,1,3,1,3,1,3,1,3,1,3}),10),10) returns the check digit. Format the column as text so leading zeros are not lost.

Need EAN codes?

Valid, unique EAN-13 codes, registered to your company and in your account within minutes.

Buy EAN codes

Read next

This guide describes the rules as published by GS1 and the marketplaces at the time of writing. Rules change; check the current rules of your sales channel before you list. This is general information, not legal advice.