Code 128 Check Digit Calculator
Check character for any Code 128 Set B string, with the full symbol sequence from start to stop.
What it does
Code 128 packs the full printable ASCII set into compact symbols and ends every barcode with a checksum so scanners can catch misreads. The check character is one symbol computed from all the others: start value 104, plus every data value weighted by its position, taken mod 103.
This tool works in Set B, the set that covers both letter cases, digits, punctuation, and spaces, which is what most general purpose Code 128 barcodes use. Each character contributes its ASCII code minus 32.
One quirk: when the modulus lands from 95 to 102, the check is a control symbol like Code C, Shift, or FNC1 rather than a printable character. The tool names those cases, so a reading of 100 does not get mislabeled as a letter.
The output includes the whole symbol value sequence from the start symbol to the stop pattern, which is what an encoder needs to assemble the final bars.
How to use
- Type or paste the data your barcode will carry, 1 to 80 characters.
- Stick to printable ASCII; accented letters and emoji do not fit Set B.
- Read the check digit, which runs 0 to 102.
- Read the check character: a printable character up to 94, or a named control symbol above it.
- Read the full sequence from the 104 start to the 106 stop.
- Feed the sequence to any encoder that accepts symbol values directly.
Formula
- 104
- Start symbol value for Code 128 Set B.
- v
- Data value: ASCII code minus 32.
- i
- Position weight, 1 for the first data character.
- 103
- Modulus of the checksum.
- 106
- Stop pattern at the end of every Code 128 barcode.
The start symbol counts as 104 with no weight, each data character counts once per position starting at 1, and the total takes mod 103. Check values 0 to 94 map to the character with that value; 95 to 102 are DEL, FNC3, FNC2, Shift, Code C, Code B, FNC4, and FNC1 in order. This page encodes Set B and does not emit Code A or Code C switches.
Worked example
Example: KAMI in Code 128 Set B
Data KAMI.
- Values: K 43, A 33, M 45, I 41 (ASCII code minus 32).
- Weighted sum: 104 + 1 x 43 + 2 x 33 + 3 x 45 + 4 x 41 = 512.
- Check: 512 mod 103 = 100.
- 100 sits above 94, so the check character is the control symbol Code B.
- Full sequence: 104 43 33 45 41 100 106. Tool shows check 100, Code B, and that sequence.
Reference table
| Data | Weighted sum | mod 103 | Check character |
|---|---|---|---|
| KAMI | 512 | 100 | Code B (control symbol) |
| A | 137 | 34 | 'B' |
| CODE | 489 | 77 | 'm' |
| Wikipedia | 3,281 | 88 | 'x' |
Limits
- Set B only; Code A and Code C switching are out of scope.
- Printable ASCII, 1 to 80 characters.
- GS1-128 and FNC1 application identifiers use their own start conventions.
- This page computes symbol values, not rendered bars.
Common mistakes
- Subtracting 31 instead of 32 from the character code.
- Leaving the first data character unweighted, or weighting the start symbol by position.
- Expecting a letter when the check digit exceeds 94; those are control symbols.
- Mixing Code A or Code C content into a Set B sequence.
- Truncating the sequence before the 106 stop symbol.
Try it yourself
Quick checks. Answers sit tucked under each question.
Data A: what is the check character?
Sum 104 + 33 = 137, and 137 mod 103 = 34, which is the character 'B'.
Data CODE?
Values 35, 47, 36, 37. The weighted sum is 489, and 489 mod 103 = 77, the character 'm'.
Data Wikipedia in mixed case?
Check 88, the character 'x', matching the standard worked example. Uppercase WIKIPEDIA gives a different check, 19, so case matters.
Questions
What is a Code 128 check digit?
One symbol at the end of the barcode, computed from the start symbol and every data character, that scanners verify to catch misreads.
Why does KAMI show Code B as the check character?
The modulus is 100, and values 95 to 102 name control symbols. 100 is the Code B switch symbol, so the check is a control, not a glyph.
What is the 104 at the front?
The symbol value of the Set B start character. Every Code 128 barcode begins with a start symbol: 103, 104, or 105 for sets A, B, and C.
Is the printed sequence the barcode itself?
It is the symbol value sequence. Encoders turn each value into the standard bar pattern and append the 106 stop pattern.
Does the tool handle GS1-128 labels?
No. GS1-128 uses FNC1 in its start sequence and application identifiers; this page covers plain Set B data.
Does case really change the checksum?
Yes. Uppercase and lowercase have different values, so WIKIPEDIA and Wikipedia produce different check characters.