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
Barcode Scanning for Allergen and Ingredient Checks
How barcode and QR scans can help people with allergies and dietary needs find ingredient information — and why the printed label still matters.
Read article →Barcodes on Medicines: What They Contain
What barcodes and 2D codes on medicine packs are used for — identification, batch tracking and authenticity — and what scanning them can tell you.
Read article →QR Codes at Restaurants: Ordering, Menus and Paying Safely
How restaurant QR codes for menus, ordering and payment work, and simple checks to make sure you're scanning the restaurant's real code.
Read article →QR Codes in Emails and PDFs: Phishing Risks
Attackers increasingly hide phishing links inside QR codes in emails and documents. Learn how 'quishing' works and how to protect yourself.
Read article →