Skip to content

EAN-13 Check Digit Calculator

Enter the first 12 digits of an EAN-13 and get the 13th digit, the check digit, instantly. Or type all 13 digits to find out whether the code is valid. The formula and a worked example are shown below, and everything runs as light JavaScript in your browser.

Type 12 digits to get the check digit, or 13 digits to validate a full code.

Check digit

7

5901234123457

Digits and their weights
590123412345
×1×3×1×3×1×3×1×3×1×3×1×3

Odd positions add up to 17, even positions to 22. 17 + 3 × 22 = 83, and (10 − 83 mod 10) mod 10 = 7.

Your data stays on your device.

How does it work?

  1. 1Type or paste the first 12 digits to see the check digit and the complete 13-digit code.
  2. 2Or enter all 13 digits to validate them; the result says whether the last digit is correct.
  3. 3If the code is wrong, use the correct check digit shown and compare it with your number.
  4. 4Use the full code in the EAN-13 generator to draw the barcode.

What is EAN-13 Check Digit Calculator?

The last digit of an EAN-13 is a check digit. It is calculated from the other twelve so that scanners can detect a mistyped or misread number. A code whose 13th digit does not match the first 12 is invalid, and most tills will reject it.

The rule is simple. Add up the digits in odd positions (1st, 3rd, 5th and so on), add up the digits in even positions, multiply the even sum by 3 and add the two results. The check digit is the number that brings the total up to the next multiple of 10, which is written (10 − sum mod 10) mod 10.

The same calculation, with the same weights read from the right, is used for EAN-8, UPC-A, GTIN-14 and SSCC codes, which is why one method covers most retail and logistics numbers.

When should you use it?

  • You are building an EAN-13 by hand and need its last digit.
  • A supplier spreadsheet contains 13-digit numbers that you want to sanity-check.
  • A scan fails and you want to know whether the printed number is even valid.
  • You are learning or teaching how retail barcodes work.
  • You want to complete a code that is missing its final digit.

The formula with a worked example

Take the first 12 digits 590123412345. Number the positions 1 to 12 from the left: the digits are 5, 9, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5.

Step 1, odd positions (1, 3, 5, 7, 9, 11): 5 + 0 + 2 + 4 + 2 + 4 = 17.

Step 2, even positions (2, 4, 6, 8, 10, 12): 9 + 1 + 3 + 1 + 3 + 5 = 22.

Step 3, total: 17 + 3 × 22 = 17 + 66 = 83.

Step 4, check digit: (10 − 83 mod 10) mod 10 = (10 − 3) mod 10 = 7. The full code is 5901234123457.

To validate a full 13-digit code, apply steps 1 to 4 to the first 12 digits and compare the result with the 13th digit. Alternatively, weight all 13 digits (1 for odd positions, 3 for even positions, the 13th digit having weight 1) and add them up: the total must be a multiple of 10. For 5901234123457 the sum is 83 + 7 = 90, so it is valid.

This check catches every single-digit error and most swaps of two adjacent digits. The exception is a swap of two neighbouring digits that differ by exactly 5, which the formula cannot detect.

Privacy

This tool runs in your browser. What you type, paste or open is processed on your device by JavaScript and is not sent to our servers, stored or shared. Your data stays on your device.

The calculation is plain JavaScript on your device. Numbers you type are not sent or stored anywhere.

Frequently Asked Questions

How do I calculate the EAN-13 check digit by hand?

Add the digits in odd positions, add the digits in even positions and multiply that by 3, then sum both. The check digit is what you must add to reach the next multiple of 10. For 590123412345 the sum is 83, so the check digit is 7.

How do I know if a 13-digit code is valid?

Compute the check digit from its first 12 digits and compare it with the 13th. If they match the code is valid. You can also weight all 13 digits with 1 and 3 alternately: the total must end in 0.

Does a valid check digit mean the product number is real?

No. The check digit only shows the number is internally consistent. It does not prove that the GTIN was issued to a company or that it belongs to a product.

Is the check digit calculated the same way for UPC-A?

Yes. A UPC-A is an EAN-13 with a leading 0, so the weights work out the same. The same method also covers EAN-8, GTIN-14 and SSCC when the weights are read from the right.