# Interleave 2 of 5 Barcode

The interleave symbology stores digits in 2 sets of 5 stripes alternating black and white. Each set encodes a digit and these digits are interleaved together. One digit is made from the black stripes and one from the white stripes. Thus the name... Interleave 2 of 5.

Each stripe in the symbol is either black or white and each of those can be narrow or wide. A wide stripe is 2 or 3 times as thick as a narrow stripe. This ratio must be consistant throughout the symbol. This means if your wide stripes start out 2 times as wide as a narrow, they must always be 2 times as wide throughout the entire symbol. You can't have some wide stripes 2 times and others 3 times as wide as a narrow stripe.

Each wide stripe has a value based on its position. The sum of these values determines which digit is represented. Every number is made up of 2 wide and 3 narrow stripes so the digit zero has a mnemonic value of 11 (eleven). This seems odd until you look at the chart below. You will see that to have a value of zero would otherwise require a single wide stripe and this would be a bigger problem than switching a mnemonic value of 11 into the digit 0 (zero).

Weight | 1 | 2 | 4 | 7 | 0 | Mnemonic |

Digit | black or white width | ^{(using weight)} |
||||

0 | n | n | W |
W |
n | 4+7 _{(force 0)} |

1 | W |
n | n | n | W | 1+0 |

2 | n | W |
n | n | W |
2+0 |

3 | W |
W |
n | n | n | 1+2 |

4 | n | n | W |
n | W |
4+0 |

5 | W |
n | W |
n | n | 1+4 |

6 | n | W |
W |
n | n | 2+4 |

7 | n | n | n | W |
W |
7+0 |

8 | W |
n | n | W |
n | 1+7 |

9 | n | W |
n | W |
n | 2+7 |

Interleave 2 of 5 can only encode even numbers of digits. In many cases, the last digit is used as the check digit and this is calculated in the same way that UPC or EAN check digits are calculated. Often, this final digit is not displayed under the barcode because it is not part of the original number. In these case where the check digit is part of the encoded number, there are an ODD number of usable digits plus the check digit. When a check digit is not used, all of the digits are significant. There is nothing in the barcode to identify if the last digit is being used as a check digit or not. You must know this based on your application. In the event you need to encode an odd number of digits without the check digit (or an even number plus the check digit) a leading zero is added to the number to cause the end result to be an even number of digits total. The barcode also starts with a start marker made up of 4 narrow lines (black white black white) and stop mark is always located at the end also which is one wide stripe and two narrow stripes (black white black).

In our example image below, the start and stop marks are identified in yellow. The digits pairs are identified by the blue and green stripes. We are using a check digit in our example and although it doesn't show in the actual barcode (shown above), we have marked it in red in the sample below so you can see where it is being calculated in. For the example, the check digit works out to be the number 5.

Interleave 2 of 5 is prone to have partial scans. If the scanner is allowed to slip off the top or bottom of the barcode, trailing digits could be missed and the scanner could think that it has done its job. There are a couple solutions for this problem.

- Use a check digit as we have done in our examples. The application that makes use of the scanned numbers would also calculate the check digit and if it doesn't match what is expected the entire number is discarded. Using our example 1, 2, 3 ... 8, 9 give us a check digit of 5. So if only the first 5 digits scan properly, the program would use 1, 2, 3 and 4 to calculate a check digit which should be 8. Because the 5th digit of our example is 5 not 8 we know we didn't get the entire number so we discard it all.
- You could always use a fixed number of digits and left pad with zero. Then you application could check the length of the entire number including leading zeros and if it isn't what you are expecting, again you discard the entire number.
- Lastly would be to use guide bars on the top and bottom of the barcode. The guide bars must touch the top and bottom of each stripe and run straight accross in the scanning direction. These bars must also be at least 3 times wider than a narrow bar to make sure they aren't mistaken for an actual bar. If the scanner slips off the top or bottom of the symbol, these bars prevent a valid scan. There is an example shown below.

If you are interested in creating your own free Interleave 2 of 5 barcodes, you can visit our barcode page and make them and save them for your use.