EAN, UPC and GTIN check digits
Check the check digit of an EAN-8, EAN-13, UPC-A or GTIN-14, add a missing one, read the country from the GS1 prefix and convert between ISBN-10 and EAN-13. One code per line.
Code examples
Copy and paste these into your own project. Each one uses only the language's standard library, so there is nothing to install.
const body = '400638133393'
const sum = [...body]
.reverse()
.reduce((total, digit, index) => total + Number(digit) * (index % 2 === 0 ? 3 : 1), 0)
console.log(body + ((10 - (sum % 10)) % 10))What it does
Checks the check digit of a barcode number: an EAN-8, UPC-A, EAN-13 or GTIN-14. It can also work out the check digit for a code that has none, read the country from the GS1 prefix and turn an ISBN-10 into the EAN-13 printed on the same book, or back. Paste one code per line to handle many at once.
How to use it
- Type or paste one code per line. Spaces and hyphens are ignored.
- Pick what to do: Verify the check digit, Calculate the check digit (leave the last digit off) or Convert ISBN-10 and EAN-13.
- Read the result for each code, and copy a single part or the whole list.
Examples
4006381333931 is a valid EAN-13 from Germany. 4006381333932 fails, and the tool says the check digit should be 1. The body 400638133393 becomes 4006381333931 when you calculate. 0306406152 as ISBN-10 is 9780306406157 as EAN-13.
Good to know
- Valid means the check digit fits. It does not mean the product exists or who owns the number.
- The country comes from the GS1 prefix, the first digits. It names the office that issued the company number, not where the product was made.
- A UPC-A is an EAN-13 with a leading zero, and a GTIN-14 adds a packaging indicator in front of an EAN-13.
- Only an EAN-13 starting with 978 has an ISBN-10. One starting with 979 does not.
What does a valid code mean?
It means the check digit fits the other digits, so the code is well formed. It does not prove that the product exists or who owns the number: only the GS1 database can say that.
Frequently asked questions
How is the check digit worked out?
Starting from the right of the digits before the check digit, multiply them by 3 and 1 in turn and add them up. The check digit is what brings the sum to the next multiple of 10. EAN-8, UPC-A, EAN-13 and GTIN-14 all use this rule.
What does the country mean?
The first digits of an EAN-13 are a GS1 prefix. It names the GS1 office that issued the company number, not where the product was made or sold. Some prefixes are for books, coupons or use inside one company.
Is what I enter sent anywhere?
No. Every check runs in your browser and the codes are not sent to our servers.