COMPUTING THE CHECKSUM DIGIT
Code 11 uses one or two weighted checksum digits. Normally, if the length of the message to encoded is
less than 10 characters only one checksum ('C') is used, whereas both 'C' and 'K' are used if the message
is 10 characters or longer.
The 'C' checksum digit is calculated by summing the weighted value of each byte in the message, dividing
by 11 (modulo 11), and using the remainder as the check digit which is appended to the message. The weight
used starts from 1 at the right-most character in the message and increments by 1 as you move to the left,
up to 10. If the message contains more than 10 characters, the 11th character is assigned a weight of 1
and the weight again increases by 1 as you continue to move to the lefft.
The 'K' checksum digit is calculated basically the same was as the 'C' checksum digit, but the 'K'
checksum includes the 'C' checksum as the right-most character in the message, and the weighting only goes
up to 9 before "wrapping around" back to 1.
The steps for calculating the checksum digits, thus, are as follows:
- Start at the right-most character in your message and assign that a weight of 1.
- Multiply the character value by the weight and add the result to a running checksum total.
A dash (-) has a weight of 10.
- As you move from right to left through the message, incremenet the weight by one. Thus the
second-to-last character has a weight of 2. Repeat step 2 for each character in the message.
- Once you've added the weighted value of each character, divide the result by 11. The remainder
from this division becomes the 'C' checksum digit. This is appended to your message.
- If your message has 10 or more characters, you should also calculcated a second 'K' checksum digit.
- Start at the right-most character in your message (which is now the 'C' checksum digit) and assign
it a weight of 1.
- Multiply the character value by the weight and add the result to a running checksum total. A
dash (-) has a weight of 10.
- As you move from right to left through the message, increment the weight by one. Thus the
second-to-last character (which used to be the last character of the message before you appended the
'C' checksum digit) has a weight of 2. Repeat step 7 for each character in the message.
- Once you've added the weighted value of each character, divide the result by 9. The remainder from
this division becomes the 'K' checksum digit. This is appeneded to your message after the 'C'
checksum digit.
Thus, as an example, if your original message was 123-45, the 'C' checksum digit would be calculated
as follows:
| MESSAGE |
1 |
2 |
3 |
- |
4 |
5 |
| Weight |
6 |
5 |
4 |
3 |
2 |
1 |
| Weighted Value |
6 |
10 |
12 |
30 |
8 |
5 |
Above, we've multiplied each character in the message by its weight depending on its position. We then sum
the weighted values 6 + 10 + 12 + 30 + 8 + 5 = 71. We divide this by 11 which gives us 6 with a remainder
of 5. Thus our 'C' check digit is 5, and we append this to our message. Our message now becomes 123-455.
This message is less than 10 characters, so it would not generally be considered necessary to use a second
check digit-but for the sake of example we will calculate it.
| MESSAGE |
1 |
2 |
3 |
- |
4 |
5 |
5 |
| Weight |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
| Weighted Value |
7 |
12 |
15 |
40 |
12 |
10 |
5 |
Again, we sum the weighted values of 7 + 12 + 15 + 40 + 12 + 10 + 5 = 101. We divide this by 11 and, in this
case, we get 9 with a remainder of 2-so our 'K' check digit is 2. We append this to our message and get a
final message of 123-4552. These are the characters that are encoded in the bar code.
NOTE: It is important to remember that the 'C' checksum weighting goes
from 1 (right-most) up to 10 and then starts again at 1. The 'K' checksum weighting goes from 1 (right-most)
up to only 9 and then starts at 1 again.
ENCODING THE SYMBOL
In the following text, we will discuss the encoding of the bar code by considering that the
number "1" represents a "dark" or "bar" section of the bar code whereas a "0" represents a
"light" or "space" section of the bar code. Thus the numbers 1101 represents a double-wide
bar (11), followed by a single-wide space (0), followed by a single-wide bar (1). This
would be printed in the bar code as:

STRUCTURE OF A CODE 11 BARCODE
A Code 11 Barcode has the following structure:
- A start/stop character, encoded from the table below.
- Any number of characters encoded from the table below.
- An optional (but highly recommended) 'C' check digit calculated as described above and encoded from
the table below.
- An optional (but recommended for messages with a length greather than 10) 'K' check digit calculated
as described above and encoded from the table below.
- A start/stop character, encoded from the table below..
CODE 11 ENCODING TABLE
This table indicates how to encode each digit of a Code 11 bar code. Note that the "Width Encoding" column
is expressed as "0" (narrow bar or space) or "1" (wide bar or space) while the "Barcode Encoding" column
represents how the bar code will actually be encoded as described above in "Encoding the Symbol."
For example, the character 0 is defined as "00001" by Code 11. This means a "Narrow bar, narrow space,
narrow bar, narrow space, wide bar". We convert this to "101011" in the "Barcode Encoding" column which is
consistent with the method we've used to express bar code formats in other documents on this site.
ASCII CHARACTER | WIDTH ENCODING | BARCODE ENCODING |
| 0 | 00001 | 101011 |
| 1 | 10001 | 1101011 |
| 2 | 01001 | 1001011 |
| 3 | 11000 | 1100101 |
| 4 | 00101 | 1011011 |
| 5 | 10100 | 1101101 |
| 6 | 01100 | 1001101 |
| 7 | 00011 | 1010011 |
| 8 | 10010 | 1101001 |
| 9 | 10000 | 110101 |
| - (Dash) | 00100 | 101101 |
| Start/Stop | 00110 | 1011001 |
NOTE 1: Since the first and last element of every character is always a bar, a
narrow space is appended at the end of each character to separate the last bar of a character from the first
bar of the character that follows.
NOTE 2: Code 11 is interesting in that there are always 3 bars and 2 spaces
of varying sizes, but the total size (width) of a character varies depending on the character being encoded.
The characters 0, 9, and dash only require 6 elements of space whereas the rest require 7.
CODE 11 ENCODING EXAMPLE
We will now code the example we used above, 123-4530. Remember that the original message was just
123-4530/B>, but that we appended two checksum digits in the example above.
NOTE: The example above was actually 123-4552 but the following
example encodes "123-4530".
- The START/STOP character: 1011001.
- An intercharacter space encoded as 0.
- The digit "1": enocded as 1101011.
- An intercharacter space encoded as 0.
- The digit "2": enocded as 1001011.
- An intercharacter space encoded as 0.
- The digit "3": enocded as 1100101.
- An intercharacter space encoded as 0.
- The digit "-": enocded as 101101.
- An intercharacter space encoded as 0.
- The digit "4": enocded as 1011011.
- An intercharacter space encoded as 0.
- The digit "5": enocded as 1101101.
- An intercharacter space encoded as 0.
- The 'C' checksum digit "3": enocded as 1100101.
- An intercharacter space encoded as 0.
- The 'K' checksum digit "0": enocded as 101011.
- An intercharacter space encoded as 0.
- The STOP Frame bar: 1011001.
This is shown in the following graphical representation where the bar code has been sectioned-off into areas
that reflect each of the 19 components just mentioned. However, the inter-character spacing are not numbered,
only the actual characters.
© Copyright 2006 BarCodeIsland.com, Inc. All Rights Reserved.
Information provided "as-is" without warranty. Please see details.
Contact us for usage and copy permission.