Check Digits: How a Barcode Catches Its Own Typos
The last digit of a product barcode is a check digit. See how it is calculated and why it prevents most misreads.
The last digit of a product barcode has a special job. It is a check digit, and it lets a scanner verify that the other digits were read correctly.
Why it exists
Scanners can misread a digit if the code is smudged or the light is poor. A check digit gives a quick test. If the calculation does not match, the scan is rejected, and the scanner tries again.
How it is calculated for EAN-13
Take the first 12 digits.
- Add the digits in odd positions (1st, 3rd, 5th, and so on).
- Add the digits in even positions (2nd, 4th, and so on) and multiply that sum by 3.
- Add the two results together.
- The check digit is the number needed to bring the total up to the next multiple of 10.
A worked example
Take the first 12 digits 590123412345.
- Odd positions: 5 + 0 + 2 + 4 + 2 + 4 = 17
- Even positions: 9 + 1 + 3 + 1 + 3 + 5 = 22, and 22 × 3 = 66
- Total: 17 + 66 = 83
- The next multiple of 10 is 90, so the check digit is 7
The full number is 5901234123457.
What it catches
A check digit catches:
- any single wrong digit
- most cases where two neighbouring digits are swapped
It does not catch every possible error, but it catches most.
Other codes
Many codes use check digits, including ISBNs, credit card numbers and some shipping labels. Each has its own formula.
Tips
- Trust a failed scan. It is protecting you from a wrong result.
- Rescan if the digits look off.
- Type in the digits below the bars if you must.
QR Code Scanner helps you rescan quickly, and keeps your scan history for later reference.
Scan and create QR codes and barcodes with QR Code Scanner →
QR Code Scanner
Fast QR & barcode scanner with a built-in QR code generator
More about QR Code Scanner
Code 128 and Code 39: The Barcodes Behind Labels and Warehouses
Beyond product barcodes, many labels use Code 128 or Code 39. Learn what they encode and where you will meet them.
Read article →Data Matrix, PDF417 and Aztec: The Other 2D Codes
QR is the best-known square code, but others exist. A guide to Data Matrix, PDF417 and Aztec and where each appears.
Read article →How EAN-13 and UPC-A Product Barcodes Are Structured
What the digits under a product barcode mean: country or prefix, maker, product and the final check digit.
Read article →ISBN Barcodes on Books: What the Numbers Tell You
How the ISBN identifies a book edition, why it starts with 978 or 979, and how the barcode on the back cover relates to it.
Read article →