Check Digit Calculator
Compute a check digit for GTIN style codes by entering the base number and leading zeros, then generate the full code with its format.
Check Digit Calculator
Result will appear here...
SIMILAR TOOLS
The last digit is not part of the number
Look at the barcode number on almost anything you own. The final digit of it is doing something different from all the others. It does not identify the manufacturer or the product; it is calculated from the digits that come before it, and its entire job is to catch mistakes.
That digit is called a check digit, and the idea is quietly clever. Because it is derived from the rest of the number by a fixed rule, any system reading the code can recompute it and see whether it matches. If someone mistypes a digit, the recomputed check digit will not agree with the one on the end, and the code is rejected on the spot rather than being accepted as some other product entirely. This calculator computes that digit for you: enter a code without its check digit, and it returns the digit and the complete number.
How the check digit is worked out
The method is the standard modulo-10 calculation used across GS1 codes, the global standards that barcodes follow, and it has three steps.
First, working from the rightmost digit of your code and moving left, multiply the digits alternately by 3 and by 1. So the last digit is tripled, the one before it is left alone, the one before that is tripled, and so on down the number. Second, add all those results together to get a single sum. Third, work out how much more you would need to reach the next multiple of ten, and that amount is the check digit. If the sum lands exactly on a multiple of ten, the check digit is 0. Written compactly, the check digit is (10 − (sum mod 10)) mod 10. The alternating weights are the heart of it, and the next-to-last section explains why they were chosen.
A worked example
Take the 12-digit code 400638133393, which needs a check digit to become a complete 13-digit product number.
Starting from the right, the digits are tripled and left alone in turn: the final 3 becomes 9, the 9 before it stays 9, the next 3 becomes 9, and so on back through the number. Adding all twelve results gives a sum of 89. The next multiple of ten above 89 is 90, so the check digit is 90 minus 89, which is 1. The complete code is therefore 4006381333931, and that is a valid, real-world product number. Change any single digit in it and the arithmetic no longer works out, which is precisely the point.
Code formats and the leading zeros
How many digits your code has determines which standard it belongs to, and the calculator identifies this for you from the length. The common ones:
| Digits entered | Complete code | Format |
|---|---|---|
| 7 | 8 | GTIN-8 |
| 11 | 12 | GTIN-12, the UPC used across North America |
| 12 | 13 | GTIN-13, the EAN used widely elsewhere |
| 13 | 14 | GTIN-14, for cartons and cases |
| 16 | 17 | GSIN, for shipments |
| 17 | 18 | SSCC, for logistics units such as pallets |
GTIN stands for Global Trade Item Number, the identifier for a product, and the number after it is the total length including the check digit. The leading zeros selector exists because length is what determines the format, and codes are often padded with zeros at the front to reach a required length. The calculator strips any leading zeros you type and applies the number you choose from the dropdown instead, so use that control rather than typing the zeros into the code box. Since those zeros count toward the total length, they affect both the format identified and the check digit itself.
What it catches, and the one thing it misses
The alternating 3 and 1 weights are not decorative. They are chosen to catch the mistakes people actually make when typing long numbers, and it is worth knowing how well they work.
Against single-digit errors, typing one wrong digit anywhere in the code, the scheme is perfect. Any such mistake shifts the weighted sum by an amount that can never be a multiple of ten, so the check digit always disagrees and the error is always caught. That is the most common typing error, and it is fully covered.
Against transpositions, swapping two adjacent digits, it does very well but not perfectly, and the gap is worth knowing honestly. Swapping neighbouring digits changes the weighted sum by twice the difference between them, so the error slips through only when that difference is exactly 5, since twice 5 is 10 and the sum is unchanged mod ten. In practice that means the pairs 0 and 5, 1 and 6, 2 and 7, 3 and 8, and 4 and 9 can be swapped without detection. Every other adjacent transposition is caught. So a single check digit is a strong, cheap safeguard rather than an absolute guarantee, which is exactly what it is designed to be: one extra digit that eliminates the overwhelming majority of realistic errors at almost no cost.
Where these codes turn up
Product codes are not really a finance topic, but they run through the paperwork of any business that moves physical goods, which is why this tool sits alongside the invoicing ones.
You need a correct check digit whenever you are creating a new product code for something you sell, setting up items in an inventory or accounting system, preparing shipping labels, or checking that a code on a supplier's invoice or delivery note is valid before it goes into your records. Getting one wrong is the kind of small error that propagates quietly, mismatched stock records, a delivery routed to the wrong item, an invoice line that will not reconcile. Verifying a code takes a second and prevents all of that, which pairs naturally with our invoice calculator when you are putting the paperwork together.
Questions people ask
What is a check digit?
It is the final digit of a barcode or product code, calculated from all the preceding digits. It carries no information about the product itself; its purpose is to let any system verify the code was entered correctly by recomputing it and comparing.
How is it calculated?
Starting from the rightmost digit and moving left, multiply the digits alternately by 3 and 1, add the results, then take the amount needed to reach the next multiple of ten. That amount is the check digit, and it is 0 if the sum is already a multiple of ten.
Why does the number of leading zeros matter?
Because the total length of a code determines its format, and leading zeros count toward that length. They also enter the check digit calculation, so padding a code with zeros can change both the format identified and the resulting digit.
What errors does it detect?
It catches every single-digit error without exception, and nearly every swap of two adjacent digits. The only transpositions it misses are adjacent digits differing by exactly 5, such as 1 and 6 or 4 and 9, because those leave the weighted sum unchanged.
What is a GTIN?
A Global Trade Item Number, the GS1 identifier for a product. GTIN-8, GTIN-12, GTIN-13, and GTIN-14 differ only in length, with the number indicating the total digits including the check digit. GTIN-12 is the North American UPC and GTIN-13 the EAN used more widely.
References
The modulo-10 check digit method, the alternating weights applied from the rightmost position, and the GTIN and SSCC code structures follow GS1's published specifications below.
Olga Chernova is an equity research analyst and final year Economics and Finance student at the American University in Bulgaria, with hands on experience in valuation and financial modeling. She has passed CFA Level I and contributed to a 2nd place team in the 2025-2026 CFA Institute Research Challenge in Bulgaria. At Eon Tools, she reviews finance tools.