QR & Barcodeby CodingMarble

Barcode check digit explained, with worked examples

The final digit of a retail barcode is not part of the product number. It is a check on the other digits, and you can calculate it by hand in under a minute. The barcode generator does the same sum for you.

What the check digit does

An EAN-13 has twelve data digits and one check digit. A UPC-A has eleven and one. The check digit is worked out from the others by a fixed formula, so a scanner can recompute it and compare. If the digits it read do not produce the digit it also read, the scan is rejected and the till stays silent rather than ringing up the wrong item.

It catches the usual mistakes: a single wrong digit is always caught, and most swaps of two neighbouring digits are caught too.

The calculation in five steps

  1. Write down the data digits without the check digit.
  2. Starting from the right-hand digit, multiply every other digit by 3. The rightmost data digit gets 3, the next one gets 1, then 3, then 1, and so on.
  3. Add all the results.
  4. Find how far that total is below the next multiple of 10.
  5. That difference is the check digit. If the total is already a multiple of 10, the check digit is 0.

The same rule works for EAN-13, UPC-A, EAN-8 and ISBN-13, because they all use the same weighting from the right.

Worked example one: an EAN-13

Take the twelve digits 400638133393. Reading from the right, the weights alternate 3 and 1:

Digit393331836004
Weight313131313131
Product99939124318004

The sum is 89. The next multiple of 10 is 90, so the check digit is 1, and the full number is 4006381333931.

Worked example two: a UPC-A

Start with the eleven digits 03600029145. From the right: 5 x 3 = 15, 4 x 1 = 4, 1 x 3 = 3, 9 x 1 = 9, 2 x 3 = 6, 0 x 1 = 0, 0 x 3 = 0, 0 x 1 = 0, 6 x 3 = 18, 3 x 1 = 3, 0 x 3 = 0.

Add them: 15 + 4 + 3 + 9 + 6 + 0 + 0 + 0 + 18 + 3 + 0 = 58. The next multiple of 10 is 60, so the check digit is 2 and the code is 036000291452.

Worked example three: an ISBN-13

Books use EAN-13 with a prefix of 978 or 979. Start with 978030640615. From the right: 5 x 3 = 15, 1 x 1 = 1, 6 x 3 = 18, 0 x 1 = 0, 4 x 3 = 12, 6 x 1 = 6, 0 x 3 = 0, 3 x 1 = 3, 0 x 3 = 0, 8 x 1 = 8, 7 x 3 = 21, 9 x 1 = 9.

The total is 93. The next multiple of 10 is 100, so the check digit is 7, giving 9780306406157. Older ten-digit ISBNs use a different formula, so convert an ISBN-10 to its 13-digit form before applying this one.

Checking a number you already have

You can run the sum backwards to verify a full barcode. Take the first twelve digits of an EAN-13, calculate the check digit as above, and compare it with the thirteenth. If they differ, the number was mistyped or copied wrongly somewhere.

Try it on 4006381333931: the first twelve digits give 89, the check digit is 1, and the thirteenth digit is 1. They match. Now change the last data digit from 3 to 8 and the total rises by 15, to 104, which would need a check digit of 6 instead. The old final digit 1 no longer fits, so any scanner would refuse it. This is the same mismatch a damaged label produces.

It is worth doing this before you send artwork to a printer. A wrong digit in a design file is cheap to fix on screen and expensive to fix on ten thousand cartons.

Why a scanner rejects a wrong digit

A laser or camera reader does not know the product. It sees bars, converts them to digits and runs the same sum you just did. A smudged bar, a torn label or a typed digit changes the total, the final digit no longer matches, and the read is thrown away. That is deliberate: it is better to rescan than to sell the wrong item.

The check digit proves the number is internally consistent. It does not prove the number belongs to you. A product barcode still needs a number that is allocated to your company through GS1, which is covered in barcode for your product in India.

How the generator handles it

For EAN-13, UPC-A, EAN-8 and ISBN, you can type only the data digits and the barcode generator appends the check digit for you. If you type the full number, it validates it and warns you when the last digit is wrong rather than printing a barcode that will fail at the till.

A common mistake is to type twelve digits into a UPC-A field, which wants eleven, or to enter an old ISBN-10 in an EAN-13 field. If the result looks one digit off, count what you typed before anything else. For a batch of labels, the same rule applies row by row in the bulk barcode generator.

Questions people ask

Can I choose my own check digit?

No. It is fixed by the other digits. Change any data digit and the check digit changes with it.

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

The method is identical. A UPC-A is treated as an EAN-13 with a leading zero, so the result is the same.

What if my total is exactly 90?

Then the check digit is 0, because 90 is already a multiple of 10.

Does a valid check digit mean the barcode is registered?

No. It only shows the digits are consistent. Registration depends on the number being allocated to you by GS1.

Do Code 128 and Code 39 use this formula?

No. They have their own, different check methods, and for Code 39 the check character is optional.

Updated 2026-10-14 · Written by the CodingMarble team

Tools used in this guide

More guides

Designed & built by CodingMarble.com Made in India. Websites, web apps and SEO-first tools. Visit the studio