# HELP! The last digit of my retail barcode is wrong?!

The last digit of all UPC, ISBN and EAN barcodes is called a check digit. Barcode Producer automatically calculates this for you so that an incorrect check digit can’t be used (thereby rendering an invalid barcode). In fact, if you try entering a check digit and it’s the wrong one, Barcode Producer will just ignore it and use its own, correct one.

UPC, ISBN, and EAN codes are all GS1 ID Keys — their data structures are a component of GTINs and follow the global GS1 specification. The last digit of all fixed-length, numeric GS1 Identification Keys is a check digit that ensures the integrity of the key. All GS1 ID Keys need a check digit, except Component/Part Identifier (CPID), Global Individual Asset Identifier (GIAI) and Global Model Number (GMN).

A UPC-A number, for example, is an 11-digit number — the 11 digits represent the actual data — plus one check digit, to make a code of 12 digits. When you enter the first 11 digits in Barcode Producer, you’re entering a number in the GTIN-12 format without the check digit.

Now, Barcode Producer is intelligent enough to calculate the check digit by itself, so when you enter a *correct* check digit, it looks as if *you* have entered it, but it’s actually the app that has already calculated the number and is adding it to the barcode.

When you enter a wrong check digit, however, you will see Barcode Producer ignoring your input and just adding the right check digit instead. There’s no magic involved, just good programming on the part of the Barcode Producer developers.

You can always check if this is true by either calculating the check digit with the GS1 online calculator or by calculating it yourself as follows:

- Sum the digits at odd-numbered positions (1st, 3d, 5th, 7th, 9th, 11th).
- Multiply the result by 3.
- Add the digit sum at even-numbered positions (2nd, 4th, 6th, 8th, 10th) to the result.
- Find the result modulo 10 (i.e. the remainder, when divided by 10) and call it M.
- If M is zero, then the check digit is 0 — otherwise the check digit is 10 − M.

Of course, there’s no need to do this if you have Barcode Producer. It will do it for you, so you can even forget about that check digit as the app will faithfully add it for you.