Check digit
A check digit is the last digit of a barcode number, computed from the others so a scanner can detect a misread. EAN-13 and UPC-A always have one; in ZPL you send the first 12 or 11 digits and the printer computes it.
تم التحديث في 2026-10-20 · Renders made with the OpenZPL engine
Open in the viewerHow EAN-13 computes it
- Take the first 12 digits.
- Multiply digits in odd positions by 1 and in even positions by 3, counting from the left.
- Add the results.
- The check digit is what brings the sum up to the next multiple of 10.
For 590123412345: 5 + 27 + 0 + 3 + 2 + 9 + 4 + 3 + 2 + 9 + 4 + 15 = 83, so the check digit is 7 and the full number is 5901234123457.

^XA ^BY3,2,140 ^FO100,50^BEN,140,Y,N ^FD590123412345^FS ^XZ
Sending 13 digits
If you send all 13 digits to ^BE with a wrong last digit, the OpenZPL engine ignores it and prints the computed one: 5901234123450 renders exactly like the label above, ending in 7. The barcode is valid, but it no longer matches the number in your system. Check what your printer does before relying on it; the safe choice is to send 12 digits.
Check digit and Code 128 checksum
Code 128 also has a check character, but it is never printed in the human-readable line and never part of your data: the printer adds it inside the symbol. A check digit, by contrast, is part of the number people read and type. Code 39 has an optional mod-43 check character, switched on with the second parameter of ^B3.
أسئلة
Do UPC-A and EAN-8 work the same way?
Yes, with the same 3-1 weighting from the right-hand end: UPC-A takes 11 digits in ^BU and EAN-8 takes 7 in ^B8, and the printer adds the check digit.