# Check Digit Calculator

By Hanna Pamuła, PhD candidate

With this check digit calculator you can confirm the integrity of a barcode. Whether you're trying to determine the last digit of the GTIN code or simply ensuring you didn't make a typo, all you need to do is spend a few seconds copying the code into our calculator. This barcode check digit calculator works for 8, 12, 13, 14, 17, 18-digit GTIN standards. If you want to know more about the algorithm behind the calculation (mod 10 check digit) or you simply want to understand what is a check digit, keep scrolling.

## What is a check digit?

Check digits are used to spot human errors - if you are typing a number manually, especially a long one, it is probable that you mistype it by adding an extra digit, omitting one or changing the digits' order. Check digits are the digits computed by an algorithm which can inform you about these typing errors. They are widely used nowadays, e.g. in bank accounts numbers, ISSN and ISBN numbers, Universal Product Codes and European Article Number which all adhere to GTIN standards.

## What is GTIN? GTIN stands for Global Trade Item Number - it's a unique identifier for trade items developed by GS1, an organization creating global business standards. The family of codes within the GTIN is:

• GTIN-12 (UPC) is used primarily in North America; it may be shown in UPC-A, ITF-14, or GS1-128 barcodes;
• GTIN-13 (EAN-13) - mainly used in the item registration process in supermarkets;
• GTIN-8 (EAN-8) - shortened version of GTIN-13;
• GTIN-14 (EAN/UCC-128 or ITF-14) - used for traded goods. May be created from GTIN-8, GTIN-12 or GTIN-13 by zero padding (adding zeros at the beginning to obtain 14 digits).

When we use names such as UPC (Universal Product Code) or EAN (European Article Number), we refer to the Global Trade Item Number, because they are both examples of GTINs. So if you are looking for a UPC check digit calculator, our tool is doing its job.

The barcode choice depends on the application: e.g. books sold internationally usually have the GTIN-13 code, GTIN-8 may be used for chewing gum (space constraints - longer GTIN-13 may simply not fit), GTIN-12 is used primarily for trade items scanned at the point of sale and GTIN-14 is used in wholesale shipments.

## What do the numbers in the barcode mean?

So, what's the meaning of the digits in the barcode?

1. GTIN-13 (EAN-13)

GTIN-13 = Country code + Manufacturer prefix + Product code + Check digit

First 2 or 3 digits are known as country codes. Remember that it is not necessarily the products' country of origin, but the country in which the manufacturer is registered, and the barcode assigned.

1. GTIN-8 (EAN-8)

GTIN-8 = Country code + Product code

1. GTIN-12 (UPC-12, UPC)

GTIN-12 = Manufacturers prefix + Product code + Check digit

1. GTIN-14 (EAN/UCC-128 or ITF-14)

GTIN-14 = Quantity/Packaging Indicator + Manufacturer code + Product code + Check digit

• 1st digit is called a logistic variant and it indicates a packaging level ( e.g., two-pack, case, pallet; however, no standards among countries exist).
• 2nd to 13th digit - a unique company prefix and an item reference number; these two components vary in length, but sum up to 12 digits.

Check digits in all versions mentioned above are calculated from a standard modulo 10 formula. You'll find the explanation of that algorithm below.

## Mod 10 check digits - formula

To calculate the check digit of e.g. GTIN-8, you need to:

1. Multiply the value of each position by the weight from the table. In our case, the weights are equal to 1 and 3. So the first digit is multiplied by 3, the second one by 1, the third by 3, etc.

ID Key
Format

Digit positions

GTIN-8

N1

N2

N3

N4

N5

N6

N7

N8

GTIN-12

N1

N2

N3

N4

N5

N6

N7

N8

N9

N10

N11

N12

GTIN-13

N1

N2

N3

N4

N5

N6

N7

N8

N9

N10

N11

N12

N13

GTIN-14

N1

N2

N3

N4

N5

N6

N7

N8

N9

N10

N11

N12

N13

N14

GSIN

N1

N2

N3

N4

N5

N6

N7

N8

N9

N10

N11

N12

N13

N14

N15

N16

N17

SSCC

N1

N2

N3

N4

N5

N6

N7

N8

N9

N10

N11

N12

N13

N14

N15

N16

N17

N18

Multiply by:

3

1

3

1

3

1

3

1

3

1

3

1

3

1

3

1

3

1. Sum all these values.
2. Subtract this sum from nearest equal or higher multiple of ten - this is your check digit! It should be the same as the final digit of your barcode.

Instead, you can use the formula:

`check_digit = 10 - (weightA * (N1 + N3 + N5 + ... + Nm) + weightB * (N2 + N4 + N6 + ... + Nn)) mod 10`

where

• `weightA` and `weightB` are proper weights;
• `N1 + N3 + N5 + ... + Nm` are consecutive odd digits;
• `N2 + N4 + N6 + ... + Nn` are consecutive even digits;
• `(...) mod 10` is the remainder after division of `(...)` by `10`

There is one essential condition to mention: if a `check_digit` calculated from the above formula equals to 10, then we need to change it to a 0 to obtain a digit, not a number.

## Barcode check digits

In this barcode check digit calculator we implemented checking the last digit in common GS1 barcodes:

• GTIN-8 (7 digits + check digit)
• GTIN-12 (11 digits + check digit)
• GTIN-13 (12 digits + check digit)
• GTIN-14 (13 digits + check digit)
• GSIN (Global Shipment Identification Number, 16 digits + check digit)
• SSCC (Serial Shipping Container Code, 17 digits + check digit)

This calculator has an informational purpose; we want to show you how the check digit is calculated according to the modulo 10 algorithm. However, our tool doesn't check if the barcode exists or if it is a valid number. The software that creates product codes is responsible for verification of the code and its check digits.

## How to use the check digit calculator - example

Let's check what is the barcode check digit of the fictitious code 112345567809:

1. Add all digits in even positions (digits in position 2, 4, 6, 8, 10 and 12):

`1 + 3 + 5 + 6 + 8 + 9 = 32`

1. Multiply the result by 3:

`32 * 3 = 96`

1. Sum all digits in odd positions (digits in position 1, 3, 5, 7, 9, and 11)"

`1 + 2 + 4 + 5 + 7 + 0 = 19`

1. Add the results of steps 2 and 3:

`96 + 19 = 115`

1. Subtract it from nearest equal or higher multiple of ten:

`120 - 115 = 5`

Here it is! Now you know what is the check digit of the GTIN-13 code. Try to find it yourself with our check digit calculator!

Hanna Pamuła, PhD candidate

## Get the widget!

Check Digit Calculator can be embedded on your website to enrich the content you wrote and make it easier for your visitors to understand your message.

It is free, awesome and will keep people coming back! 