# How to calculate a check digit for UPC, EAN and GTIN codes

> The GS1 check digit method step by step: weights per code length, worked UPC-A and EAN-13 examples, a formula for Excel and Google Sheets, and why checks fail.

Source: https://central.to/guides/check-digit-calculation · Updated 2026-11-23 · Published by Central (https://central.to)

## In short

- The last digit of a UPC, EAN or other GTIN is a check digit, calculated from all digits before it with one GS1 method for every code length.
- Starting at the digit next to the check digit and moving left, the digits are multiplied by 3 and 1 in turn; the check digit brings the sum up to the next multiple of 10.
- For GS1 US's sample UPC 61414199999 the sum is 144, so the check digit is 6 and the complete UPC-A is 614141999996.
- GTIN-8, GTIN-12, GTIN-13, GTIN-14, the 17-digit GSIN, the 18-digit SSCC and ISBN-13 all use this method; only the weight of the first digit differs with the length.
- A correct check digit shows that a number is well formed, not that GS1 issued it or that it belongs to the product.
- Excel removes leading zeros and shows numbers of 12 or more digits in scientific notation unless the cells are text, so a UPC from a spreadsheet can fail the check without a wrong digit.

Free tool: [GTIN check digit calculator](https://central.to/tools/check-digit-calculator). Check GTIN, EAN and UPC codes or calculate their check digit, one code or a whole file at once.

## The method in three steps

The last digit of a UPC, EAN or any other GTIN is a check digit. It is calculated from the digits before it, and GS1 uses one method for every code length:

1. **Take the code without its last digit.** For a UPC-A that is 11 digits, for an EAN-13 it is 12.
2. **Multiply and add.** Start at the right end, with the digit that sits next to the check digit. Multiply it by 3, the next digit to the left by 1, the next by 3, and so on. Add up all the results.
3. **Fill up to the next multiple of 10.** The check digit is what you must add to the sum to reach the next multiple of 10. If the sum already ends in 0, the check digit is 0.

GS1 gives the same steps in its instructions on [how to calculate a check digit manually](https://www.gs1.org/services/how-calculate-check-digit-manually): multiply each position by 3 or 1, add the results, and subtract the sum from the nearest equal or higher multiple of ten.

To skip the arithmetic, use the [check digit calculator](https://central.to/tools/check-digit-calculator) at the top of this page. It checks complete codes of 8, 12, 13 or 14 digits and shows the right digit where one is wrong. Codes of 7 or 11 digits always get their check digit added; with the option "without check digit: calculate it", codes of 12 and 13 digits get one too. Paste one code per line, up to 5,000 lines, or load a CSV, text or Excel file.

**The parts of an EAN-13 (GTIN-13).**

- `400`: GS1 prefix. Which GS1 organization issued the number. 400 to 440 is GS1 Germany. It does not say where the product was made.
- `638133393`: Company prefix and item reference. The rest of the company's GS1 prefix, then the number it gave this product. Where one ends and the other starts differs per company.
- `1`: Check digit. Calculated from the other 12 digits. A typo almost always breaks it.

## The weights for each code length

Counting starts at the right, so the weight of the first digit depends on how long the code is. GS1's table lines all formats up at the right edge. Read from the left, it gives these patterns:

| Code | Digits in total | Digits you multiply | First digit is multiplied by | Weights from left to right |
| --- | --- | --- | --- | --- |
| GTIN-8 (EAN-8) | 8 | 7 | 3 | 3 1 3 1 3 1 3 |
| GTIN-12 (UPC-A) | 12 | 11 | 3 | 3 1 3 1 3 1 3 1 3 1 3 |
| GTIN-13 (EAN-13) | 13 | 12 | 1 | 1 3 1 3 1 3 1 3 1 3 1 3 |
| GTIN-14 | 14 | 13 | 3 | 3 1 3 1 3 1 3 1 3 1 3 1 3 |
| GSIN (shipment number) | 17 | 16 | 1 | 1 3, repeated eight times |
| SSCC (logistic unit number) | 18 | 17 | 3 | 3 1, repeated eight times, then 3 |

Two rules of thumb replace the table. The digit next to the check digit always gets 3. A code with an even number of digits in total starts with 3, and a code with an odd number starts with 1.

Zeros add nothing to the sum, so a code keeps its check digit when you put zeros in front of it. [GS1's prefix list](https://www.gs1.org/standards/id-keys/company-prefix) notes that a 12-digit GTIN has an implied leading zero, and [GS1's support pages](https://support.gs1.org/support/solutions/articles/43000734386-are-all-gtins-unique-numbers-) say that systems needing one 14-digit format add leading zeros to shorter GTINs. The UPC `614141999996`, its 13-digit form `0614141999996` and its 14-digit form `00614141999996` all end in 6. How the 12-digit and the 13-digit form relate is the subject of [EAN vs UPC](https://central.to/compare/ean-vs-upc).

## Worked example: UPC-A

GS1 US uses the sample UPC `6 14141 99999 6` in its [guide to UPCs](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs): company prefix 614141, item reference 99999, check digit 6. This is where the 6 comes from. A UPC-A has 11 digits before the check digit, so the first digit gets weight 3.

| Position | Digit | Multiply by | Result |
| --- | --- | --- | --- |
| 1 | 6 | 3 | 18 |
| 2 | 1 | 1 | 1 |
| 3 | 4 | 3 | 12 |
| 4 | 1 | 1 | 1 |
| 5 | 4 | 3 | 12 |
| 6 | 1 | 1 | 1 |
| 7 | 9 | 3 | 27 |
| 8 | 9 | 1 | 9 |
| 9 | 9 | 3 | 27 |
| 10 | 9 | 1 | 9 |
| 11 | 9 | 3 | 27 |

The results add up to 144. The next multiple of 10 is 150, and 150 - 144 = 6. The complete UPC-A is `614141999996`.

A shortcut for a pocket calculator: add the digits in the "times 3" positions (6 + 4 + 4 + 9 + 9 + 9 = 41) and multiply by 3 (123). Then add the other digits (1 + 1 + 1 + 9 + 9 = 21). The total is again 144.

## Worked example: EAN-13

The EAN-13 examples on this page start with 952, the prefix GS1 lists as "used for demonstrations and examples of the GS1 system", so they cannot belong to a real product. Say a headlamp of the fictional brand Northpeak has the first 12 digits `952123454321`. An EAN-13 has 12 digits before the check digit, so the first digit gets weight 1.

| Position | Digit | Multiply by | Result |
| --- | --- | --- | --- |
| 1 | 9 | 1 | 9 |
| 2 | 5 | 3 | 15 |
| 3 | 2 | 1 | 2 |
| 4 | 1 | 3 | 3 |
| 5 | 2 | 1 | 2 |
| 6 | 3 | 3 | 9 |
| 7 | 4 | 1 | 4 |
| 8 | 5 | 3 | 15 |
| 9 | 4 | 1 | 4 |
| 10 | 3 | 3 | 9 |
| 11 | 2 | 1 | 2 |
| 12 | 1 | 3 | 3 |

The results add up to 77. The next multiple of 10 is 80, and 80 - 77 = 3. The complete EAN-13 is `9521234543213`.

GS1's own example works the same way: the 12 digits `629104150021` add up to 57, so the check digit is 60 - 57 = 3.

## A case number needs its own check digit

When the headlamp ships in a case of 12, the case can get a GTIN-14: an indicator digit from 1 to 8, the first 12 digits of the item's GTIN-13, and a new check digit. [GS1 US](https://www.help.gs1us.org/create-a-case-and-generate-a-barcode) reserves the value 9 for variable measure items. With indicator 1 the 13 digits are `1952123454321`. A GTIN-14 starts with weight 3:

3 + 9 + 15 + 2 + 3 + 2 + 9 + 4 + 15 + 4 + 9 + 2 + 3 = 80

80 is already a multiple of 10, so the check digit is 0 and the case number is `19521234543210`. Copying the 3 from the single item would give `19521234543213`, which fails the check.

The converter below writes a UPC or EAN in its 12, 13 and 14-digit forms and builds the GTIN-14 for a case with the indicator you choose. It recalculates the check digit.

Free tool: [UPC, EAN and GTIN-14 converter](https://central.to/tools/upc-ean-gtin-converter). Convert between UPC-A, EAN-13 and GTIN-14, and build GTIN-14 codes for cases and multipacks.

## How to check a complete code

To test a code that already has its check digit, include that digit in the sum with weight 1. A well-formed code gives a multiple of 10.

- `614141999996`: 144 + 6 = 150. Valid.
- `9521234543213`: 77 + 3 = 80. Valid.
- `9521234543218`: 77 + 8 = 85. Not valid. The last digit should be 3.

Channels expect codes that pass this test. Google Merchant Center asks merchants to make sure that [the check digit is present and correct](https://support.google.com/merchants/answer/6324461). [OpenAI's product feed schema](https://developers.openai.com/commerce/specs/file-upload/products) takes a `gtin` of exactly 8, 12, 13 or 14 digits, including a valid check digit, and describes the same 3 and 1 method. If Merchant Center reports identifier problems, see [how to fix missing identifiers in Merchant Center](https://central.to/guides/merchant-center-missing-identifiers).

## A formula for Excel and Google Sheets

This formula returns the check digit. It reads cell A2, which holds the code **without** its check digit, stored as text: 7, 11, 12, 13 or 17 digits, no spaces.

```
=MOD(10-MOD(SUMPRODUCT(MID(REPT("0",17-LEN(A2))&A2,SEQUENCE(17),1)*(1+2*MOD(SEQUENCE(17),2))),10),10)
```

How it works, from the inside out:

1. `REPT("0",17-LEN(A2))&A2` puts zeros in front of the code until it has 17 digits, the longest case (an SSCC without its check digit). Zeros do not change the sum, and the digit next to the check digit now always sits at position 17.
2. `MID(...,SEQUENCE(17),1)` picks the 17 digits one by one.
3. `1+2*MOD(SEQUENCE(17),2)` is 3 for odd positions and 1 for even positions, so position 17 gets 3, as in GS1's table.
4. `SUMPRODUCT` multiplies and adds. `MOD(10-MOD(sum,10),10)` fills up to the next multiple of 10 and turns a 10 into 0.

For `61414199999` in A2 the formula returns 6, for `952123454321` it returns 3, and for `1952123454321` it returns 0. To get the complete code, write `=A2&` in front of the formula (without the second equals sign).

The second formula reads a **complete** code in A2 and returns TRUE when it has 8, 12, 13 or 14 digits and a correct check digit. Letters, spaces and other lengths give FALSE.

```
=IFERROR(AND(OR(LEN(A2)=8,LEN(A2)=12,LEN(A2)=13,LEN(A2)=14),MOD(SUMPRODUCT(MID(REPT("0",18-LEN(A2))&A2,SEQUENCE(18),1)*(1+2*MOD(SEQUENCE(18),2))),10)=0),FALSE)
```

> [!NOTE] If your Excel version has no `SEQUENCE` function, replace `SEQUENCE(17)` with `ROW(INDIRECT("1:17"))` and `SEQUENCE(18)` with `ROW(INDIRECT("1:18"))`. If your spreadsheet uses a comma as the decimal sign, separate the arguments with semicolons.

Keep the code column as text. Otherwise the spreadsheet changes the codes before any formula sees them (see the causes below). When you collect identifiers from suppliers, a [supplier product data template](https://central.to/guides/supplier-product-data-template) with a text column for the GTIN keeps the codes intact.

## What a check digit catches

These results follow from the weights 3 and 1. You can try each one in the calculator.

| Error | Caught? | Example |
| --- | --- | --- |
| One wrong digit | Always | `9521234548213` gives 95, not a multiple of 10 |
| Two neighboring digits swapped | Yes, unless the two digits differ by 5 (0 and 5, 1 and 6, 2 and 7, 3 and 8, 4 and 9) | `9521234534213` gives 82 and fails; `164141999996` gives 140 and passes, although the 6 and the 1 are swapped |
| Two digits swapped that are two places apart | Never, because both have the same weight | `416141999996` passes |
| A made-up number | One in ten random numbers passes | For any 12 digits, exactly one of the ten possible last digits is correct |

GS1 puts it this way: the check digit makes sure the barcode number is correctly composed. GS1 US adds that scanners use it to verify that a code was read correctly.

## What it cannot prove

A correct check digit says that a number is well formed. It does not say that GS1 issued the number, that it belongs to your product, or that it is the number of this variant.

- **Was the number issued, and to whom?** [Verified by GS1](https://www.gs1.org/services/verified-by-gs1) looks up a GTIN in GS1's database. GS1's support pages say the lookup is free for up to 30 queries a day and returns at least who assigned the number.
- **Do marketplaces look further?** Amazon says it [verifies UPCs against the GS1 database](https://sellercentral.amazon.com/help/hub/reference/external/GLE2KYT2UVPMTYGS), treats numbers that do not match as invalid and removes those listings.
- **Is the range allowed?** Google does not accept GTINs from the restricted ranges (prefixes 02, 04 and 2) or the coupon ranges (05, 98 and 99), whatever their check digit.

So never complete or "repair" a number by calculation alone and send it to a channel. If a product has no number yet, read [how to get a barcode from GS1](https://central.to/guides/how-to-get-a-barcode); the basics of the numbering system are in [what a GTIN is and how to get one](https://central.to/guides/what-is-a-gtin). An internal stock code with a correct check digit is still not a GTIN; the [comparison of UPC, EAN, GTIN, SKU and MPN](https://central.to/compare/upc-ean-gtin-sku-mpn) shows which number goes into which field.

## Why a check fails: common causes

A failed check does not always mean a wrong digit. Check these causes first:

| What you see | Cause | Fix |
| --- | --- | --- |
| A UPC with 11 digits | Excel removed the leading zero. Microsoft states that Excel automatically removes leading zeros. | Restore the zero, for example with `=TEXT(A2,"000000000000")` for a 12-digit column, then keep the column as text. |
| `6.14142E+11` | Excel's General format shows numbers of 12 or more digits in scientific notation. | Format the cells as Text before you paste or import. If the digits are gone from the file, go back to the source. |
| An 18-digit SSCC that ends in 000 | Excel keeps 15 significant digits and changes later digits to zero. | Import the column as text; the lost digits cannot be restored. |
| A valid code with one digit more or less than expected | The same number with or without a leading zero. `012345678905` and `0012345678905` are both valid. | Nothing is wrong. Store one length consistently. |
| A 14-digit case number that fails | The check digit of the single item was kept. | Recalculate it for all 13 digits. |
| Spaces, dashes or letters | Formatting from a label or a PDF. | Remove them. Google ignores spaces and dashes; OpenAI's feed wants none. |
| An 8-digit UPC-E or a 10-digit ISBN | Short forms with their own rules. | Convert to 12 digits (UPC-E) or to ISBN-13 first, as Google asks. |

> [!WARNING] An 11-digit number is read as a UPC without check digit, by this page's calculator too, which then adds a 12th digit and marks the row "Check digit added". If the 11 digits came from a UPC that lost its leading zero, that result is wrong: `12345678905` would become `123456789050` instead of `012345678905`. Put the zero back first.

Microsoft describes both Excel behaviors and the fixes in [Keeping leading zeros and large numbers](https://support.microsoft.com/en-us/office/keeping-leading-zeros-and-large-numbers-1bf7b935-36e1-4985-842f-5dfa51f85fe7). It also notes that a custom number format does not restore zeros that were removed before the formatting. Once the numbers pass, the [barcode generator](https://central.to/tools/barcode-generator) draws EAN-13, UPC-A and EAN-8 symbols from them.

## ISBN-13, GLN and SSCC use the same method

GS1 states that the last digit of all its fixed-length numeric identification keys is a check digit. Its manual lists GTIN-8, GTIN-12, GTIN-13, GTIN-14, GSIN and SSCC, and the calculator of GS1 US also covers the 13-digit GLN, a location number.

Books fit in as well. The [International ISBN Agency](https://www.isbn-international.org/content/what-isbn/10) describes the check digit of the 13-digit ISBN as a modulus 10 system with alternate weights of 1 and 3. GS1's support pages show the conversion of an old 10-digit ISBN: drop its last character, put 978 in front and recalculate. ISBN `0471384291` becomes `978047138429` plus check digit 8, so `9780471384298`. Google asks merchants to submit the 13-digit form in `gtin`.

## Where Central helps

Central researches the identifiers a listing needs, such as GTIN, brand and MPN, in your own data, on the open web and in verified databases, and backs every value with sources you can check. A number the sources do not support is held back, so a GTIN is never guessed or completed by calculation. The data is then prepared within the rules of each channel you choose.

## Questions

### How do you calculate a UPC check digit?

Take the first 11 digits. Starting at the right, multiply the digits by 3 and 1 in turn, add the results, and take the number that brings the sum up to the next multiple of 10. For 61414199999 the sum is 144, so the check digit is 6.

### Is the check digit calculated the same way for EAN-13 and UPC-A?

Yes. GS1 uses one method for all GTIN lengths. The digit next to the check digit is always multiplied by 3, so the first digit of a UPC-A gets weight 3 and the first digit of an EAN-13 gets weight 1.

### What does a wrong check digit mean?

At least one digit differs from the number that was issued, or digits are missing. Common causes are a leading zero that a spreadsheet removed, a typing error, or the check digit of a single item copied onto a case number.

### Can a number with a correct check digit still be invalid?

Yes. One in ten random numbers has a correct check digit. Whether GS1 issued a number, and to whom, shows in the GS1 database, which Verified by GS1 searches. Amazon says it checks UPCs against that database.

### Does ISBN-13 use the same check digit?

Yes. The International ISBN Agency describes the ISBN-13 check digit as a modulus 10 system with alternate weights of 1 and 3, which is the GTIN-13 method. A 10-digit ISBN has to be converted to 13 digits first.

## Sources

1. [How to calculate a check digit manually](https://www.gs1.org/services/how-calculate-check-digit-manually), checked 2026-11-23
2. [Check digit calculator](https://www.gs1.org/services/check-digit-calculator), checked 2026-11-23
3. [GS1 Company Prefix](https://www.gs1.org/standards/id-keys/company-prefix), checked 2026-11-23
4. [What is a UPC Code?](https://www.gs1us.org/upcs-barcodes-prefixes/guide-to-upcs), checked 2026-11-23
5. [Check Digit Calculator](https://www.gs1us.org/tools/check-digit-calculator), checked 2026-11-23
6. [Are all GTINs unique numbers?](https://support.gs1.org/support/solutions/articles/43000734386-are-all-gtins-unique-numbers-), checked 2026-11-23
7. [Create a Shipping Case (GTIN-14) and Generate an ITF-14 Barcode](https://www.help.gs1us.org/create-a-case-and-generate-a-barcode), checked 2026-11-23
8. [How do I check if a GS1 GTIN is valid?](https://support.gs1.org/support/solutions/articles/43000734070-how-do-i-check-if-a-gs1-gtin-is-valid-), checked 2026-11-23
9. [Verified by GS1](https://www.gs1.org/services/verified-by-gs1), checked 2026-11-23
10. [How is an ISBN used in a GS1 barcode?](https://support.gs1.org/support/solutions/articles/43000734165-how-is-an-isbn-used-in-a-gs1-barcode-), checked 2026-11-23
11. [What is an ISBN?](https://www.isbn-international.org/content/what-isbn/10), checked 2026-11-23
12. [GTIN [gtin]](https://support.google.com/merchants/answer/6324461), checked 2026-11-23
13. [Product feed schema](https://developers.openai.com/commerce/specs/file-upload/products), checked 2026-11-23
14. [Valid UPCs](https://sellercentral.amazon.com/help/hub/reference/external/GLE2KYT2UVPMTYGS), checked 2026-11-23
15. [Keeping leading zeros and large numbers](https://support.microsoft.com/en-us/office/keeping-leading-zeros-and-large-numbers-1bf7b935-36e1-4985-842f-5dfa51f85fe7), checked 2026-11-23
16. [Available number formats in Excel](https://support.microsoft.com/en-us/office/available-number-formats-in-excel-0afe8f52-97db-41f1-b972-4b46e9f1e8d2), checked 2026-11-23

## More on this topic: Barcodes and product identifiers

- [What is a GTIN and how do you get one?](https://central.to/guides/what-is-a-gtin.md)
- [Amazon GTIN exemption: who qualifies and how to apply](https://central.to/guides/amazon-gtin-exemption.md)
- [ASIN](https://central.to/glossary/asin.md)
- [EAN](https://central.to/glossary/ean.md)
- [EAN vs UPC: the difference and how to convert one into the other](https://central.to/compare/ean-vs-upc.md)
- [GS1 Digital Link](https://central.to/glossary/gs1-digital-link.md)
- [GS1 Sunrise 2027: 2D barcodes and what sellers need to do](https://central.to/guides/gs1-sunrise-2027.md)
- [GTIN](https://central.to/glossary/gtin.md)
- [GTIN-14](https://central.to/glossary/gtin-14.md)
- [How to get a barcode (UPC or EAN) for your product](https://central.to/guides/how-to-get-a-barcode.md)
- [identifier_exists](https://central.to/glossary/identifier-exists.md)
- [ITF-14](https://central.to/glossary/itf-14.md)
- [MPN](https://central.to/glossary/mpn.md)
- [SKU](https://central.to/glossary/sku.md)
- [SKU numbers: how to create a SKU system that scales](https://central.to/guides/how-to-create-sku-numbers.md)
- [SKU vs UPC: what each code is for and when you need both](https://central.to/compare/sku-vs-upc.md)
- [UPC](https://central.to/glossary/upc.md)
- [UPC vs EAN vs GTIN vs SKU vs MPN: what each number is for](https://central.to/compare/upc-ean-gtin-sku-mpn.md)
- [GTIN check digit calculator](https://central.to/tools/check-digit-calculator.md) (Free tool)
- [UPC, EAN and GTIN-14 converter](https://central.to/tools/upc-ean-gtin-converter.md) (Free tool)
- [EAN and UPC barcode generator](https://central.to/tools/barcode-generator.md) (Free tool)
- [SKU generator](https://central.to/tools/sku-generator.md) (Free tool)

## Try Central on your own products

Central is the AI-first product content operating system: you choose the input (your shop, files or product pages) and the channels; Central AI researches, verifies and writes the product data and content in between, every value backed by sources you can check. The first 3 products are free. To start with a shop, open https://central.to/users/sign_up?onboarding_url=SHOP_ADDRESS (replace SHOP_ADDRESS with the shop's website address).
