Advertisement
Advertisement
DEVELOPER

GTIN Check Digit Calculator — UPC, EAN, GTIN-14, GLN and SSCC

Work out the GS1 check digit for a barcode number, or check whether a complete one is self-consistent, with the weighted-sum working shown digit by digit.

To calculate, enter the number without its final digit. To validate, enter the whole thing including the check digit.
Digits only. Spaces, hyphens and other separators are ignored, so a number copied from a label with grouping still works.
All of these use the same modulo-10 algorithm with alternating weights, so one calculation covers every one of them.
Leading zeros never change the check digit, because a zero contributes nothing to the weighted sum whichever weight it gets. Padding is how a GTIN-12 becomes a GTIN-13 or GTIN-14 in a database.
Check digit
 
 
0
Complete number
0
Weighted sum
0
Sum modulo 10
0
Key length used
Tip: a check digit only proves a number is internally consistent. It says nothing about whether that number has been issued to anyone, and it never will.
Advertisement

The GTIN check digit calculator above implements the standard GS1 modulo-10 check digit used on every retail barcode number: GTIN-8, GTIN-12 which is the familiar UPC-A, GTIN-13 which is EAN-13, GTIN-14 for cases and pallets, the thirteen-digit Global Location Number and the eighteen-digit Serial Shipping Container Code. One algorithm covers all of them, and the tool shows the working rather than just the answer.

Arb Digital builds free tools that are honest about what they prove. This one proves arithmetic consistency and nothing else. A number with a correct check digit is not thereby assigned, registered, active or yours to use. Real GTINs are built on a company prefix that GS1 licenses to a specific organisation, and inventing a digit sequence that happens to satisfy the checksum produces a number that is invalid in every sense that matters commercially.

What This Check Digit Calculator Does

Every GS1 identification key ends in a digit computed from all the digits before it. Its purpose is to catch keying and scanning errors: a single mistyped digit always changes the weighted sum, so the check fails and the mistake is caught at the point of entry rather than after it has propagated through a system.

The tool runs in two directions. Given the data digits it computes the check digit and shows the completed key. Given a complete key it recomputes the check digit and compares, reporting whether the number is self-consistent and, if not, what the last digit should have been. In both cases the weighted sum and its remainder are shown, because seeing the working is what makes the algorithm memorable.

GS1 publishes its own implementation, and the GS1 US Check Digit Calculator covers the same keys: GTIN-8, GTIN-12, GTIN-13, GTIN-14, GLN, SSCC and bill of lading numbers. If a number matters commercially, checking it against the issuer's own tool as well costs nothing.

How to Use It

  1. Choose calculate or validate. Calculate expects the number without its final digit; validate expects the complete key.
  2. Paste the number. Separators are stripped, so a number copied from a label with spaces or hyphens still works.
  3. Leave the key type on detect unless you need padding. The length usually identifies the key on its own.
  4. Use padding when moving between key lengths. A GTIN-12 padded with a leading zero is the same key as a GTIN-13, and the check digit does not change.
  5. Read the working. The weighted sum and its remainder are shown so you can follow, or reproduce, exactly how the digit was derived.

The Formula: How the Check Digit Is Derived

Take the digits of the key excluding the check digit. Starting from the rightmost of those and working left, multiply alternate digits by three and one, so the digit immediately before the check position gets a weight of three, the one before that a weight of one, and so on. Add the products. The check digit is whatever must be added to that total to reach the next multiple of ten, which is ten minus the sum modulo ten, and zero when the sum is already a multiple of ten.

Work the default. The twelve data digits 6 2 9 1 0 4 1 5 0 0 2 1 are weighted from the right as 3, 1, 3, 1 and so on, giving 1×3, 2×1, 0×3, 0×1, 5×3, 1×1, 4×3, 0×1, 1×3, 9×1, 2×3 and 6×1. Those products are 3, 2, 0, 0, 15, 1, 12, 0, 3, 9, 6 and 6, and the total is 57. Fifty-seven modulo ten is seven, so the check digit is ten minus seven, which is three, and the complete GTIN-13 is 6291041500213.

The alternating weights are the whole trick. If every digit had the same weight, transposing two adjacent digits would leave the sum unchanged and the error would pass unnoticed. Giving neighbours different weights means a transposition changes the sum by twice the difference between the two digits, which is detected unless that difference is exactly five.

Advertisement

What the Check Digit Cannot Tell You

This is the part that matters most, and it is routinely misunderstood. Passing the check means only that the digits are arithmetically consistent with each other. It does not mean the number has been allocated to a company, that a product exists behind it, that the barcode is licensed for retail sale, or that scanning it anywhere will find a record.

Real identification keys begin with a GS1 company prefix, which GS1 issues to a specific organisation as a licensed allocation. The organisation then assigns item reference numbers within that prefix and computes the check digit for each, which is what GS1's own check digit calculator exists to do. The check digit is the last and least significant step in that process; the licensing is the part that makes the number mean something.

The practical consequences are worth stating plainly. Generating a number that satisfies the checksum does not give you a usable barcode, and a retailer's systems will reject or fail to recognise it. Reusing another company's prefix is a straightforward misuse of their allocation. And a validation routine in your own software that only checks the digit is a typo filter, not a verification step, so it should never be described to users as confirming that a product code is real.

Padding, Key Lengths and the Zeros That Do Not Matter

A single physical product often appears with several key lengths in the same system: a GTIN-12 on the retail pack in North America, a GTIN-13 in Europe, and a GTIN-14 on the case. GS1's convention is to store them right-aligned in a fourteen-digit field, padded with leading zeros, so that comparisons work across formats.

Padding is safe because a leading zero contributes nothing to the weighted sum regardless of which weight it receives. That is why a GTIN-12 and the same number with a leading zero as a GTIN-13 share a check digit, and why a database can normalise everything to fourteen digits without recomputing anything.

Where it does go wrong is in spreadsheets. A leading zero is silently dropped when a barcode number is treated as a numeric value, which turns a valid GTIN-13 into an eleven-or-twelve-digit fragment whose check digit is now in the wrong position. If a number that scanned correctly yesterday fails validation today, a cell format is the first thing to look at, well before the algorithm.

How This Page Sits Beside the Other Encoding Tools

The boundary in one sentence: this page computes and verifies the GS1 modulo-10 check digit that is part of the number itself, while the barcode generator draws a Code 128 symbol and computes that symbology's own modulo-103 checksum, which is a different thing entirely and is not a GS1 check digit.

The Luhn algorithm calculator covers the other well-known modulo-10 scheme, the one used on payment card and IMEI numbers; it doubles alternate digits and folds the results rather than weighting by three, and the two are not interchangeable. For error detection in transmitted data rather than in printed numbers, the parity bit calculator and the Hamming code calculator cover detection and correction, and the hash generator covers integrity checks over whole files. The character counter is a quick way to confirm a key is the length you think it is.

Need a website that loads fast and actually works?

Arb Digital builds free tools like this one because useful pages earn attention. If you want tools, calculators or content built for your own audience, we can help.

See Our Web Design Work Talk to Arb Digital

Common Mistakes to Avoid

  • Treating a valid check digit as proof the code is real — it proves internal consistency only, never that a number has been issued, registered or is in use.
  • Weighting from the left — the alternation is anchored at the check digit position and runs leftwards, so starting from the other end gives the wrong answer on odd lengths.
  • Including the check digit in the sum — when calculating, the weighted sum covers the data digits only.
  • Letting a spreadsheet eat leading zeros — a barcode number stored as a number loses them, which shifts every weight and breaks the check.
  • Confusing it with Luhn — payment cards use a different modulo-10 scheme, and applying one algorithm to the other's numbers fails almost every time.

Related Free Tools From Arb Digital

Draw a symbol with the barcode generator, and compare schemes with the Luhn algorithm calculator. For error detection in data rather than in printed numbers, use the parity bit calculator and the Hamming code calculator, or the hash generator for whole-file integrity. Convert between bases with the number base converter, check lengths with the character counter, and browse the full free online tools hub for everything else.

Frequently Asked Questions

Does a valid check digit mean the barcode number is real?

No. It means only that the digits are arithmetically consistent with one another. It does not mean the number has been assigned, registered or is in use anywhere. Real keys are built on a company prefix that GS1 licenses to a specific organisation.

How is the GS1 check digit calculated?

Take the data digits, and from the rightmost one working left, weight them alternately by three and one. Add the products. The check digit is ten minus the total modulo ten, and zero when the total is already a multiple of ten.

Is this the same as the Luhn algorithm?

No. Both are modulo-10 schemes, but Luhn doubles alternate digits and adds the digits of any result above nine, whereas the GS1 method multiplies by three and one and does not fold. Applying one to the other's numbers will almost always fail.

Do leading zeros change the check digit?

No. A zero contributes nothing to the weighted sum whichever weight it receives, so padding a GTIN-12 to thirteen or fourteen digits leaves the check digit unchanged. That is why keys can be stored right-aligned in a fourteen-digit field.

Which keys does this cover?

GTIN-8, GTIN-12 which is UPC-A, GTIN-13 which is EAN-13, GTIN-14 for cases, the thirteen-digit Global Location Number and the eighteen-digit Serial Shipping Container Code. They all use the same modulo-10 calculation with alternating weights.

What errors does the check digit catch?

Every single mistyped digit, because changing one digit always changes the weighted sum. It also catches most transpositions of adjacent digits, though not those where the two digits differ by exactly five, since that case leaves the sum unchanged modulo ten.

How do I get a real barcode number?

By obtaining a company prefix from GS1, which licenses allocations to organisations. Item references are then assigned within that prefix and the check digit is computed for each. This page performs only that final arithmetic step.

Why did a working number suddenly fail validation?

The most common cause is a spreadsheet or an import that treated the number as numeric and dropped its leading zeros. That shortens the key, shifts every weight and breaks the check even though no digit was retyped.

Advertisement
Advertisement

Take it further