Check Digit Calculator

Calculate the check digit for a GTIN, UPC-A, or EAN-13 barcode number, or validate a complete code, using GS1's standard mod-10 weighted-sum formula.

Quick Facts

Formula
check digit = (10 − (weighted sum mod 10)) mod 10
Weights alternate 3, 1, 3, 1... starting from the rightmost data digit and moving left.
Standard lengths
GTIN-8, GTIN-12/UPC-A, GTIN-13/EAN-13, GTIN-14
All four use the same weighted-sum formula, just with more digits.
Issued by
GS1, the global barcode standards body
GS1 assigns company prefixes; the check digit is a formula anyone can compute.

Your Results

Calculated
Result
-
Generated check digit, or Valid/Invalid
Complete code
-
Full number including the check digit
GTIN format
-
Digit count and matching GS1 standard
Weighted sum
-
Alternating 3x/1x sum, mod 10

Ready

Choose a mode, enter a GTIN, UPC, or EAN code, then press Calculate.

How the Check Digit Calculator works

Every GTIN, UPC-A, and EAN-13 barcode number ends with a check digit — a single digit computed from the digits before it, so a scanner or database can catch typos and misreads. This calculator applies GS1's official weighted-sum formula to either generate the check digit for a code that is missing one, or to validate a complete code that already has one.

The formula

Starting from the rightmost digit of the data (the digits before the check digit) and moving left, assign alternating weights of 3 and 1, beginning with 3 on the last digit. Multiply each digit by its weight and add the products together. The check digit is the value from 0 to 9 that brings that sum up to the next exact multiple of 10:

check digit = (10 − (weighted sum mod 10)) mod 10

To validate a complete code, run the same formula on all the digits except the last one, then compare the result to the last digit. If they match, the code is internally consistent; if not, it contains an error.

Worked example

Take the 11-digit UPC-A data string 04900002891. Working from the right, the digits and their alternating weights are 1×3, 9×1, 8×3, 2×1, 0×3, 0×1, 0×3, 0×1, 9×3, 4×1, 0×3, which sum to 3 + 9 + 24 + 2 + 0 + 0 + 0 + 0 + 27 + 4 + 0 = 69. Since 69 mod 10 = 9, the check digit is 10 − 9 = 1, giving the complete 12-digit UPC-A code 049000028911.

One formula, four GTIN lengths

  • GTIN-8: 7 data digits + 1 check digit = 8 total, used for very small packages.
  • GTIN-12 / UPC-A: 11 data digits + 1 check digit = 12 total, the standard US/Canada retail barcode.
  • GTIN-13 / EAN-13: 12 data digits + 1 check digit = 13 total, the standard barcode outside North America.
  • GTIN-14: 13 data digits + 1 check digit = 14 total, used on shipping cartons and cases.

The weighting rule is identical across all four — always start with weight 3 on the rightmost data digit — so the same calculation handles every standard GTIN length.

What the check digit does and does not confirm

A matching check digit confirms the code is internally consistent under the mod-10 formula — it catches the great majority of single mistyped digits and many adjacent-digit swaps. It does not confirm the code was ever assigned by GS1, corresponds to a real registered product, or is unique in any database. Treat a "valid" result as a data-integrity check, not proof that a barcode is legitimate or in use.

Frequently Asked Questions

How is a GTIN, UPC, or EAN check digit calculated?
Starting from the rightmost digit of the code (excluding the check digit) and moving left, multiply each digit alternately by 3 and 1, beginning with 3 on the last digit. Add all the products together. The check digit is whatever value from 0 to 9, when added to that sum, brings the total up to the next exact multiple of 10.
Does the same formula work for GTIN-8, UPC-A, EAN-13, and GTIN-14?
Yes. GS1 defines one check-digit algorithm for all standard GTIN lengths: GTIN-8 (7 data digits), UPC-A / GTIN-12 (11 data digits), EAN-13 / GTIN-13 (12 data digits), and GTIN-14 (13 data digits). The weighting always starts with 3 on the rightmost data digit regardless of the total length.
How do I validate a barcode number that already has a check digit?
Remove the last digit and treat it as the claimed check digit. Run the same weighted-sum formula on the remaining digits to compute the expected check digit. If the expected value matches the claimed digit, the code is internally consistent; if not, the code contains a data-entry error or is not a valid GTIN.
Can this calculator catch every barcode error?
No. The check digit only confirms the digits are internally consistent under the mod-10 weighted formula; it does not confirm the code was ever issued by GS1, is assigned to a real product, or is unique. It catches most single-digit typos and many digit transpositions, but not every possible transcription error.