# GS1 check digit calculator and GTIN checker

Paste one barcode or a whole column. Each code is checked as a GTIN-8, 12, 13 or 14, its GS1 check digit is worked out, and an 11-digit UPC that lost its leading zero comes back repaired. It all runs in this browser tab: no barcode is sent anywhere.

[Use the interactive checker](https://twelfth.ai/tools/gtin-check-digit): paste one barcode per line. It reports each as valid, repaired or invalid, with the corrected code where there is one.

## How the GS1 check digit works

1. Take every digit except the last. The last digit is the check digit.
2. Starting from the right, multiply the digits by 3, 1, 3, 1 and so on.
3. Add the results.
4. The check digit is whatever brings that sum up to the next multiple of 10. If the sum is already a multiple of 10, it is 0.

## The check digit of a UPC, step by step

Take the UPC 036000291452. The first 11 digits are 0 3 6 0 0 0 2 9 1 4 5. From the right, the weights are 3, 1, 3, 1…, so the products are 5×3, 4×1, 1×3, 9×1, 2×3, 0×1, 0×3, 0×1, 6×3, 3×1 and 0×3.

They add up to 15 + 4 + 3 + 9 + 6 + 0 + 0 + 0 + 18 + 3 + 0 = 58. The next multiple of 10 is 60, so the check digit is 60 − 58 = 2, and the full code is 036000291452.

Because the weights start from the right, a zero in front changes nothing. 36000291452 still has a correct check digit. It is one digit short of a UPC, which is what a spreadsheet leaves behind when it stores a barcode as a number.

## Why the barcode matters to AI shopping agents

Shopping assistants such as ChatGPT, Gemini and Perplexity answer from product data. They match a listing to the same product at other retailers on its GTIN, and Google Merchant Center and OpenAI's product feed both check the digit. A listing without a valid barcode is harder to match, so it is easier to leave out.

[How twelfth scores a barcode for agent readiness](https://twelfth.ai/docs/agent-readiness/#agent-readiness-the-listing-score-barcode).

## Common barcode failures

- **Lost leading zero.** A UPC-A is 12 digits, and many start with 0. Store it in a number column (Excel, an ERP field typed as integer, a CSV opened and saved again) and the zero goes, leaving 11 digits. Put the 0 back and store the column as text.
- **Scientific notation.** A spreadsheet can show 9300633603192 as 9.30063E+12. Saved like that, the last digits are gone for good. Export the barcode column again from the source system, formatted as text.
- **Wrong check digit.** One mistyped digit or two digits swapped almost always breaks the check digit. The tool shows what the check digit would be, but only fix it that way if you know the other digits are right. Otherwise take the code from the pack.
- **A SKU in the barcode field.** Letters, dashes or an odd length usually mean an internal code or part number was put where the GTIN belongs. Send it as the SKU or MPN instead, and leave the GTIN empty until you have the real one.
- **Store-internal codes.** Codes starting 2 (or 02 and 04 as a UPC) are for use inside one business, such as weighed produce or in-store labels. Their check digit can be right and they still match nothing outside your store.

## Questions

### What is a GS1 check digit?

The last digit of every GTIN. It is calculated from the digits before it, so a scanner, a marketplace or an AI agent can tell when a code was mistyped. It catches every single wrong digit and most cases of two neighbouring digits swapped.

### How do I calculate a GTIN check digit?

Multiply the digits before it by 3 and 1 alternately, starting with 3 at the right. Add them up, then take the amount needed to reach the next multiple of 10. Choose "Add check digit" above to do it for a whole list.

### Why does my 11-digit UPC fail?

Because a UPC-A has 12 digits. An 11-digit code whose check digit still works is almost always a UPC that lost its leading zero when it was stored as a number. Put the 0 back in front and store barcodes as text.

### Is a UPC the same as a GTIN?

Yes. A UPC-A is a GTIN-12 and an EAN-13 is a GTIN-13. Adding zeros in front to make 14 digits keeps the same product and the same check digit, which is why feeds accept either form.

### Does a valid check digit mean the barcode is right?

No. It means the code is well formed. It does not prove the code belongs to your product. GS1's Verified by GS1 service shows which company a barcode was issued to.

### Why do AI shopping agents need a barcode?

An agent matches the same product across retailers on its GTIN. Without a valid one it has to guess from the title, and Google's and OpenAI's product specifications both check the digit. The barcode is the one field that makes your listing the same product as everyone else's.

### Are the barcodes I paste stored?

No. The check runs in your browser. Nothing you paste is sent to twelfth or anyone else.

## Next step: Score every product in your range.

A barcode is one of the checks an AI shopping agent needs to pass. In a demo we score every line in your range on barcode, brand, title, image and page markup, and show what to fix first.

- [Book a demo](https://twelfth.ai/book-a-demo)
- [How the agent readiness score works](https://twelfth.ai/docs/agent-readiness/)

[All free retail tools](https://twelfth.ai/tools).
Source: https://twelfth.ai/tools/gtin-check-digit
