Skip to content
Aarrange

Check Digit Calculator

Paste codes, one per line. Get the check digit, or see if it is right, for 16 schemes. Nothing leaves your browser.

0
Lines
0
Done
0
Errors
Input
Tab types a tab. Press Escape, then Tab, to leave the editor.
Result
The result shows here as you type.Try , or .
On this page

About Check Digit Calculator

Updated

Check Digit Calculator adds the check digit to a code, or checks the one it has. Paste one code per line: product numbers, ISBNs, IBANs, card numbers or VINs. In Auto, the tool picks the scheme of each line by its shape, so one list can mix them.

Codes says what your lines are. In Auto, a full-length code is checked and a shorter one gets its digit. Set it to Add digit or Check digit when your list is all one kind. A 13-digit code with a wrong last digit is then never read as the start of a GTIN-14.

To check GS1 barcodes only, the Barcode Validator does the same with fewer settings. To draw the finished codes as barcodes, paste them in the Barcode Generator.

How to use it

  1. Paste your codes, one per line, or load a file. Spaces and hyphens inside a code are ignored.
  2. Press Calculate (Alt C). Results shows every line with its type, its digit and what is wrong.
  3. Open Steps to see the math for one line, or Excel for a formula to use in a spreadsheet.
  4. Press Fix check digits (Alt X) to give each wrong code the digit that makes it valid, or copy the finished codes from Results or Codes. Check fixed codes against the source: a swapped pair of digits also fails the check.

Schemes

  • GS1: EAN-8, UPC-A, EAN-13, ISBN-13, ISMN-13, GTIN-14, GSIN and SSCC (modulo 10, weights 3 and 1). UPC-E is expanded to UPC-A first. ISMN in its M form gets the same digit as its ISMN-13.
  • ISBN-10 and ISSN (modulo 11, where 10 is written as X). To turn an ISBN-10 into an ISBN-13 or back, use the ISBN Converter on EAN Check.
  • Luhn for card numbers, IMEI and the Canadian SIN, and NPI for US health providers.
  • IBAN (modulo 97, with the length and format of each country), ISIN, CUSIP, SEDOL and the ABA routing number.
  • VIN (the digit in position 9), Verhoeff (used in Aadhaar), Damm, and Custom with your own weights and modulus.

Auto knows GS1, ISBN, ISSN, ISMN, Luhn card lengths, IBAN, ISIN and VIN by their shape. Some schemes share a length: an ABA routing number and a CUSIP have 9 digits, like an ISBN-10 without its digit. For those, pick the scheme in Scheme. A VIN without its digit can have a ? in position 9. An IBAN can have ?? where its two check digits go, or leave them out. Scanner output that starts with ]C1 or ]d2, and label text such as (01)09501101530003, is read as the GTIN inside it. To read every element, such as the expiry date and the batch, paste it in the GS1-128 Parser on EAN Check. A label in front, as in ISSN 0378-5955, is removed. In a CSV or spreadsheet row, amounts, short numbers and ids such as TS-1001 are skipped.

Common errors

A letter for a digit

A letter O for a zero, or an I for a one, is the most common typo in a code list. The tool says which character and where.

Invalid
59O1234123457
"O" at position 3 is not a digit. Did you mean 0?
Fixed
5901234123457

A wrong check digit

A digit before it was typed wrong, or the check digit was. The tool shows the digit that makes the code valid, and Fix check digits puts it in.

Invalid
8712345678960
Check digit is 0, should be 8
With digit 8
8712345678968

Valid is not always right. Here two digits were swapped, and the real code is 8712345678906. A new check digit makes a different code. When a code comes from a supplier or a label, check it against the source.

A digit missing

With Codes set to Check digit, a code that is one digit short gets a length error, not a wrong digit.

Invalid
73001637001
11 digits is not a length that has a check digit. One digit may be missing.

Find the missing digit in the source. With the first 12 digits back, 730016370012, set Codes to Add digit, and the tool adds the 13th: 7300163700124. When the source is smudged, mark each digit you cannot read with ? in the Barcode Repair tool on EAN Check. It lists every GTIN that fits.

How the GS1 check digit works

A GS1 code (UPC, EAN, GTIN, SSCC) gives its digits the weights 3 and 1 in turn. The weight 3 goes on the digit next to the check digit. Multiply each digit by its weight and add the products. The check digit is the number that brings the sum up to a multiple of 10.

UPC-A
Digits:    0  3  6  0  0  0  2  9  1  4  5
Weights:   3  1  3  1  3  1  3  1  3  1  3
Products:  0  3 18  0  0  0  6  9  3  4 15  = 58
Next multiple of 10: 60. 60 - 58 = 2.
The check digit is 2: 036000291452

How the Luhn check digit works

Card numbers, IMEI numbers and the Canadian SIN use Luhn. Double every second digit, starting with the one next to the check digit. A doubled digit over 9 loses 9. Add all the values. The check digit brings the sum up to a multiple of 10.

Luhn
Digits:   7  9  9  2  7  3  9  8  7  1
Double:      x     x     x     x     x
Values:   7  9  9  4  7  6  9  7  7  2  = 67
Next multiple of 10: 70. 70 - 67 = 3.
The check digit is 3: 79927398713

In Results, a Luhn number also gets its kind, such as Visa card, Mastercard, American Express card or IMEI. A valid Luhn digit says the number is well formed, not that the card is real.

How the IBAN check digits work

An IBAN has two check digits, right after the country code. To calculate them, put 00 in their place and move the first four characters to the end. Turn each letter into a number (A = 10, B = 11 ... Z = 35). Divide the long number by 97. The check digits are 98 minus the remainder.

IBAN
Account part:  GB .. WEST12345698765432
Move to end:   WEST12345698765432GB00
As numbers:    3214282912345698765432161100
Remainder:     3214282912345698765432161100 mod 97 = 16
98 - 16 = 82.  The IBAN is GB82WEST12345698765432

Paste the account part with ?? for the check digits, or with no check digits at all, and the tool fills them in. It also checks the length and format of the account part for each country. A wrong IBAN is not fixed by new check digits: the typo is most likely in the account number.

Other schemes change the weights or the modulus. ISBN-10 counts weights down from 10 and divides by 11. Paste a code and open Steps to see its own math.

Check digit resources

Check digit FAQ

What is a check digit calculator?

A check digit calculator works out the last digit of a code from the digits before it. That digit lets a scanner or a program see when a code was typed or read wrong. This one also checks codes that already have their digit, for 16 schemes, a whole list at a time.

How do you calculate a check digit?

Each scheme has its own rule, but most work the same way: give each digit a weight, multiply, add the products, and divide by a fixed number (the modulus). The check digit is what brings the sum to a multiple of that number.

For GS1 codes such as EAN and UPC, the weights are 3 and 1 from the right, and the modulus is 10. Open the Steps view to see every step for your own code.

How do I calculate a UPC check digit?

Take the first 11 digits. Add the digits in the odd places (1st, 3rd ... 11th) and multiply the sum by 3. Add the digits in the even places. The check digit is the number that brings the total up to the next multiple of 10. For 03600029145 the total is 58, so the check digit is 2: 036000291452.

How do I calculate the Luhn check digit?

Start from the right of the digits before the check digit. Double every second digit, starting with the rightmost one. When a doubled digit is over 9, take away 9. Add everything. The check digit brings the sum up to the next multiple of 10. Card numbers, IMEI numbers and Canadian SINs use Luhn.

What is the Excel formula to calculate a check digit?

For GS1 codes (EAN, UPC, GTIN, SSCC) of any length, with the number without its check digit in A2 as text:

=MOD(10-MOD(SUMPRODUCT(MID(A2,LEN(A2)+1-ROW(INDIRECT("1:"&LEN(A2))),1)*(3-2*MOD(ROW(INDIRECT("1:"&LEN(A2)))+1,2))),10),10)

Open the Excel view for the formula of each scheme in your list, including Luhn, ISBN-10, ISSN, NPI, ABA and your own weights.

Does a check digit catch every mistake?

No. GS1 and Luhn catch every single wrong digit and most swapped neighbours, but not all of them. Verhoeff and Damm catch every single wrong digit and every swap of two neighbours. A valid check digit says the code is well formed, not that it belongs to a real product, account or car.

How do I calculate the IBAN check digits?

Write the country code, then two question marks, then the account part (the BBAN), for example GB??WEST12345698765432. Or leave the question marks out: GBWEST12345698765432. The tool puts in the check digits: GB82WEST12345698765432. It also checks the length and format for that country.

When a full IBAN fails its check, the tool does not change its check digits. The typo is most likely in the account part, and new check digits would make a wrong IBAN look right. Ask the owner for the right IBAN.

Are my codes sent anywhere?

No. The calculator runs in your browser. Card numbers, IBANs and product lists stay on your device. You can check this in your browser's network tab while you use it.