How to use the barcode check character calculator
- Choose Code 39 or one of the three Code 128 subsets.
- Enter the data to encode.
- Read the check character or check value in the headline.
- Check the table of symbol values, including the start and stop symbols for Code 128.
Formula
Code 39: add the values of the characters and take the sum mod 43. The check character is the character with that value
Code 39 values: 0 to 9, then A to Z as 10 to 35, then - . space $ / + % as 36 to 42
Code 128: start value (103, 104 or 105) + the sum of position x value for each data symbol, mod 103
Subset B value = ASCII code - 32. Subset C uses pairs of digits as the value
The Code 128 stop symbol has the value 106 and is not part of the check.
CODE39 and PJJ123C
In Code 39, CODE39 has the values 12, 24, 13, 14, 3 and 9, which add up to 75. Then 75 mod 43 = 32, the value of W, so the check character is W and the full text is CODE39W.
In Code 128 subset B, PJJ123C has the values 48, 42, 42, 17, 18, 19 and 35. The sum is 104 + 1 x 48 + 2 x 42 + 3 x 42 + 4 x 17 + 5 x 18 + 6 x 19 + 7 x 35 = 879, and 879 mod 103 = 55, so the check value is 55. In subset C the digits 123456 give 44, and HELLO 42 in subset A gives 14.
What a barcode check does
A check character lets a scanner reject a bad read. If one bar is misread, the sum no longer matches and the scanner refuses the code instead of returning a wrong number. Code 128 always includes a check value, which the scanner removes before giving you the data. Code 39 treats its check character as optional, so both ends must agree on whether it is used.
Code 128 has three subsets. Subset A holds capital letters and control characters, subset B has upper and lower case letters, and subset C packs pairs of digits and so makes numeric codes about half as long.
What this tool does not do
It finds the check value and lists the symbol values. It does not draw the bars or switch subsets within one code. Use the Barcode Generator to draw a barcode, the GS1 GTIN and SSCC Check Digit Builder for retail product numbers, the Check Digit Validator for other schemes, and the UPC-E to UPC-A Converter for short UPC codes.
Assumptions and limits
- Code 39 data uses capital letters, digits, space and - . $ / + % only.
- Code 128 data stays in one subset for the whole code.
- The data shown are examples. Use your own.
- Subset C needs an even number of digits.
Frequently asked questions
Does Code 39 need the check character?
No, it is optional. Add it only if the software reading the barcode expects it.
Why is the Code 128 check a number, not a character?
It is a symbol value from 0 to 102, which the barcode draws as a bar pattern, and it has no printable form of its own.
What is the start value for?
It says which subset the code starts in: 103 for A, 104 for B and 105 for C. It is the first term of the sum.
Why is lowercase refused for Code 39?
The standard Code 39 set has capital letters only. The extended form uses pairs of characters and is not covered.