| Tip: Bookmark this page with Ctrl-D (Win) or Apple-D (Mac) | Main • Products • Know How / FAQ • Download • Store • Contact |
Barcode Symbologies
How do I calculate a Code EAN 13 checksum or check digit?Code EAN uses a simple Modulo 10 checksum scheme. The 12 (or 7 in case of EAN 8) digits of the message are multiplied with '1' and '3' (alternating). The products are then summed up and integer divided by ten. The remainder (modulo) of the division is subtracted from '10', the result is the check digit.
Here is a simplified EAN 13 checksum function in C:
int _checksum_ean13(char *data)
{
int sum = 0;
int i;
for(i=11;i>=0;i--)
{
int digit = *(data + i);
if(i & 0x01)
sum += digit * 3;
else
sum += digit;
}
int mod = sum % 10;
if(mod != 0)
return 10 - mod;
return 0;
}
Note: All our applications and developer components and libraries have automatic checksum calculation for Code EAN 8 / 13 and ISBN 10 / 13.
EAN Barcode Software
- EAN / ISBN Barcode Software (Windows XP, Vista or better)
- EAN / ISBN Barcode Software (Mac OS X 10.4 or better)
Back to the main FAQ index.


