Barcode Check Digits Explained: The Math, Worked Out

That last digit on every retail barcode is not random. It is a checksum that catches typos and misprints before they become expensive mistakes.

A barcode check digit is a final digit computed from the other digits by a fixed formula. EAN-13 and UPC-A use a modulo-10 weighted sum: for example, the EAN-13 9780306406157 has check digit 7, and the UPC-A 036000291452 has check digit 2. Scanners recompute it on every read and reject symbols that do not match.

What a check digit does

A check digit is a single digit appended to a barcode number, computed from the other digits by a public formula. Its only job is error detection. If someone mistypes one digit, or a printer smudges a bar, the recomputed check digit will not match and the scanner rejects the read instead of recording the wrong number. It does not make the barcode unique and it is not a security feature; it is a typo catcher.

EAN-13 check digit, step by step

The EAN-13 formula uses the first 12 digits to compute the 13th:

  1. Starting from the left, add the digits in the odd positions (1st, 3rd, 5th, 7th, 9th, 11th).
  2. Add the digits in the even positions (2nd, 4th, 6th, 8th, 10th, 12th) and multiply that sum by 3.
  3. Add the two results. Subtract the last digit of the total from 10. If the result is 10, the check digit is 0.

Real example: the ISBN-13 9780306406157. Take the first 12 digits: 9 7 8 0 3 0 6 4 0 6 1 5.

  • Odd positions: 9 + 8 + 3 + 6 + 0 + 1 = 27
  • Even positions: 7 + 0 + 0 + 4 + 6 + 5 = 22, times 3 = 66
  • Total: 27 + 66 = 93
  • Check digit: 10 - 3 = 7

The 13th digit of the ISBN is 7, so the number is valid. Try changing any single digit and the check digit will no longer match, which is exactly the protection it provides.

UPC-A check digit, step by step

UPC-A uses the same idea with 11 data digits computing the 12th:

  1. Add the digits in the odd positions (1st, 3rd, 5th, 7th, 9th, 11th) and multiply by 3.
  2. Add the digits in the even positions (2nd, 4th, 6th, 8th, 10th).
  3. Add the two results. Subtract the last digit of the total from 10 (0 if the result is 10).

Real example: the well-known UPC-A 036000291452. First 11 digits: 0 3 6 0 0 0 2 9 1 4 5.

  • Odd positions: 0 + 6 + 0 + 2 + 1 + 5 = 14, times 3 = 42
  • Even positions: 3 + 0 + 0 + 9 + 4 = 16
  • Total: 42 + 16 = 58
  • Check digit: 10 - 8 = 2

The 12th digit is 2, so the barcode is valid.

Check digits in Code 128 and Code 39

Code 128 uses a mandatory modulo-103 check character computed from weighted character values rather than plain digits; see the worked example in Code 128 vs Code 39. Code 39 offers an optional modulo-43 check character. QR codes take a different approach entirely: Reed-Solomon error correction, which not only detects damage but reconstructs the data.

What to do when a scan fails the check

  • Re-scan before reprinting. Most failures are a bad angle or a dirty lens, not a bad symbol.
  • Check the quiet zones. Text or borders touching the blank margins on either side are the most common print defect.
  • Verify the digits. Recompute the check digit by hand with the steps above; if your data entry dropped a digit, the symbol was wrong from the start.
  • Print larger and darker. Faint or undersized bars are the next most common cause after quiet-zone violations.

Skip the hand math: the free generator computes EAN-13 and UPC-A check digits automatically and draws a print-ready symbol.

Frequently asked questions

What is a barcode check digit?

The final digit of a barcode number, computed from the preceding digits by a fixed formula. Scanners recompute it on every read; a mismatch means the symbol was misprinted or mistyped, so the scan is rejected instead of recording a wrong number.

How is the EAN-13 check digit calculated?

Add the odd-position digits, add the even-position digits multiplied by 3, add both sums, and subtract the last digit of the total from 10. For 978030640615, the sums are 27 and 66, totaling 93, so the check digit is 10 minus 3, which is 7.

Can two products have the same check digit?

Yes, constantly. The check digit is derived from the other digits, not unique to the product. About one in ten random numbers shares any given check digit. Uniqueness comes from the GTIN itself, which GS1 guarantees.

Do QR codes have check digits?

Not in the 1D sense. QR codes use Reed-Solomon error correction, which is stronger: it detects damage and reconstructs the missing data, recovering the payload even when up to 30 percent of the symbol is obscured.

Ready to make your barcode? Generate a print-ready PNG in seconds, free, with correct check digits.

Try the free barcode generator