Check Digit Calculator: GS1, UPC, ISBN and Luhn
Calculate a check digit online for free. Choose the number or barcode type, such as a UPC, EAN-13, SSCC, ISBN-10, Code 128 or a Luhn number like an IMEI, type the digits, and see the check digit with every step of the sum. Verify mode tests a full number.
5901234123457
Check digit
7
5901234123457
- Type
- EAN-13 / GTIN-13
- Algorithm
- GS1 mod 10, weights 3 and 1
- Characters
- 12 + check
- Check digit
- 7
Steps
| # | Character | Value | Weight | Product |
|---|---|---|---|---|
| 1 | 5 | 5 | ×1 | 5 |
| 2 | 9 | 9 | ×3 | 27 |
| 3 | 0 | 0 | ×1 | 0 |
| 4 | 1 | 1 | ×3 | 3 |
| 5 | 2 | 2 | ×1 | 2 |
| 6 | 3 | 3 | ×3 | 9 |
| 7 | 4 | 4 | ×1 | 4 |
| 8 | 1 | 1 | ×3 | 3 |
| 9 | 2 | 2 | ×1 | 2 |
| 10 | 3 | 3 | ×3 | 9 |
| 11 | 4 | 4 | ×1 | 4 |
| 12 | 5 | 5 | ×3 | 15 |
| Sum | 83 | |||
Nearest multiple of ten at or above 83 is 90: 90 − 83 = 7
How to Calculate a Check Digit
Choose the type, type the number without its check digit, and read the result with the steps that lead to it.
- Choose the number or barcode type, such as EAN-13, SSCC, ISBN-10 or Code 128.
- Type the number or data without its check digit; spaces and hyphens in numbers are ignored.
- Read the check digit and the full number in the result, copy them, and follow each step in the Steps card below.
- To test a number you already have, switch to Verify and enter it with its check digit: the badge says Valid or Invalid and shows the right check.
- For EAN-13, UPC-A, EAN-8, GTIN-14, SSCC, ISBN-10, Code 93 and Code 128, choose Make the barcode to open the generator with the same type and number.
Check Digit Types This Calculator Supports
The calculator covers the GS1 numbers on retail and logistics barcodes, ISBN-10 and ISSN, the check characters of Code 39, Code 93 and Code 128, and Luhn numbers.
GS1 Numbers: GTIN, UPC, EAN and SSCC
- EAN-13 / GTIN-13: 12 digits, then the check digit; a 13-digit GLN works the same way.
- UPC-A / GTIN-12: 11 digits, then the check digit.
- EAN-8 / GTIN-8: 7 digits, then the check digit.
- GTIN-14 / ITF-14: 13 digits, then the check digit.
- SSCC: 17 digits, then the check digit, as in GS1's own example.
- Any length: the same GS1 rule for other numbers, such as an Interleaved 2 of 5 check digit.
ISBN-10 and ISSN
- ISBN-10: 9 digits, then a check character from 0 to 9 or X.
- ISSN: 7 digits, then a check character from 0 to 9 or X.
Barcode Check Characters
- Code 39: an optional mod 43 check character, one of the 43 Code 39 characters.
- Code 93: two check characters, C and K, which every Code 93 barcode carries.
- Code 128: a check value from 0 to 102 over the codewords, which every Code 128 barcode carries.
Luhn Numbers
- IMEI: the first 14 digits of a phone's IMEI, then the Luhn check digit (3GPP TS 23.003).
- Payment card numbers: the same Luhn check, defined in ISO/IEC 7812; the calculator only does the arithmetic.
What Is a Check Digit?
A check digit is a digit calculated from the other digits of a number and added to it, so that a typing or reading error can be spotted.
What a Check Digit Catches
Every algorithm on this page detects a single wrong digit or character, wherever it is. The tests check this for every position and every pair of digits. The mod 11 check of ISBN-10 and ISSN also detects every swap of two neighboring digits.
What a Check Digit Misses
GS1 mod 10 misses a swap of neighboring digits that differ by 5, such as 16 and 61, and Luhn misses only a swap of 09 and 90. Code 39 adds the character values without weights, so it misses every swap. Two wrong digits can also cancel out, so a valid check digit does not prove that a number is right.
A Valid Check Digit Is Not a Registration
A GTIN with a correct check digit can still be unassigned or belong to someone else, because the check only tests the arithmetic. GTINs come from a GS1 Company Prefix or a GTIN licensed by GS1. The barcode lookup shows which GS1 office issued a number's prefix.
Check Digit Algorithm Comparison
The algorithms differ in their weights and modulus, and so in the errors they catch; this table compares them as this calculator implements them.
| Algorithm | Used in | Weights | Modulus | Swaps of neighbors caught |
|---|---|---|---|---|
| GS1 mod 10 | GTIN, UPC, EAN, SSCC, GLN, ITF | 3 and 1 from the right | 10 | All except digits that differ by 5 |
| Luhn | IMEI, payment card numbers | 2 and 1 from the right, digits of each product added | 10 | All except 09 and 90 |
| Mod 11 | ISBN-10, ISSN | 10 to 2, or 8 to 2 | 11 (10 is written X) | All |
| Mod 43 | Code 39 (optional) | None: values are added | 43 | None |
| Mod 47 (C and K) | Code 93 | 1 to 20 and 1 to 15 from the right | 47 | All |
| Mod 103 | Code 128 | Start 1, then the position | 103 | All swaps of neighboring codewords |
GS1 Check Digit Example
GS1's General Specifications work the 17 digits 37610425002123456 through to the check digit 9; this calculator shows the same steps for the SSCC type.
- Multiply the digits by 3 and 1 in turn, starting with 3 on the rightmost digit: 3×3, 7×1, 6×3 and so on.
- Add the products: 9 + 7 + 18 + 1 + 0 + 4 + 6 + 5 + 0 + 0 + 6 + 1 + 6 + 3 + 12 + 5 + 18 = 101.
- Subtract the sum from the nearest equal or higher multiple of ten: 110 − 101 = 9.
- Write the check digit last: 376104250021234569.
How the UPC check digit works the same rule worked through for a 12-digit UPC-A.
How to calculate a GTIN check digit the rule for every GTIN length.
Luhn Check Digit Example
The Luhn check doubles every second digit from the right, adds the digits, and picks the check digit that brings the total to a multiple of ten.
- Take the 14 digits of the IMEI example in 3GPP TS 23.003: 26053179311383.
- From the right, double every second digit, starting with the digit next to the check: 3, 3, 1, 9, 1, 5 and 6 become 6, 6, 2, 18, 2, 10 and 12.
- Add all the digits, counting 18 as 1 + 8, 10 as 1 + 0 and 12 as 1 + 2: the total is 53.
- Subtract from the next multiple of ten: 60 − 53 = 7, so the full IMEI is 260531793113837.
Check Digit Code in TypeScript, Python, Go and PHP
The fold The algorithm as code, under the number, shows the selected algorithm as a short function in TypeScript, Python, Go or PHP, ready to copy.
Each function is run in its own language against the published examples and 200 random inputs per algorithm, and must return exactly what the calculator returns. A language this site cannot run is not offered, so there is no Rust, C# or Java version.
Frequently Asked Questions
Is the Check Digit Part of the Barcode Number?
Yes, for GTINs, ISBNs and ISSNs: it is the last digit, printed under the barcode and returned by a scanner. Code 128 and Code 93 check characters are different, as they sit only in the bars and a scanner removes them after checking.
Why Is the ISBN-10 Check Character Sometimes X?
The ISBN-10 check uses modulus 11, so it can come out as 10, which does not fit in one digit. It is written as the letter X, as in 1-56581-231-X. ISBN-13 uses the GS1 mod 10 rule and never needs an X.
How Do I Check If a Barcode Number Is Valid?
Choose its type, switch to Verify and enter the whole number, check digit included. The calculator says whether the last digit is right, and if not, which digit it should be.
Can I Check a Credit Card Number With the Luhn Check?
Verify with the Luhn type tells you whether the last digit fits the others, which catches most typing errors. It cannot tell whether a card exists or is valid for payment. The number is not sent anywhere: the calculation runs in your browser.
Is a Mod 10 Check Digit Always the Same?
No. GS1 numbers and Luhn numbers both use modulus 10, but with different weights, so the same digits can give different check digits. For 26053179311383, Luhn gives 7 and the GS1 rule gives 2.
Can a Check Digit Correct an Error?
No. It shows that something is wrong but not which digit, so the number has to be read or typed again. Error correction, which can repair damage, is a feature of 2D codes such as QR Code and Data Matrix.
Related Barcode Tools
- Barcode lookup
Check a UPC, EAN or ISBN and see the GS1 office behind its prefix.
- SSCC barcode generator
The 18-digit SSCC with its check digit, as a GS1-128 barcode.
- Barcode generator
Make the barcode once the number is right.