There are over a hundred of types of 1D barcodes, but only a few are commonly used today. These are Code 128, Code 39, and Interleaved 2 of 5, with Code 128 being the most common and Interleaved 2 of 5 (I 2 of 5) the least.
Less common 1D codes still used today are Codabar, Code 93, Code 11, Two of Five, and MSI code.
2D barcodes are becoming more popular; I’ll write about them at a later date. 1D codes only contain data in one dimension, in the widths of the bars and spaces.
The first step to identifying a code is to note how many different bar and space widths the code uses:
Code 39 and I 2 of 5 only have two different widths of bars and spaces. If it has more than two, it’s usually Code 128, which uses four different widths. UPC uses four bar widths too, but you can usually recognize UPC from the guard bar patterns.
If the code only has two widths the next thing to look at is the start/stop patterns. The first (and last) five bars in a Code 39 symbol are narrow, narrow, wide, wide, narrow. I 2 of 5 starts with two narrow bars and ends with a wide and narrow bar. I 2 of 5 is numeric only, so if the code has two bar widths and alpha characters, it’s probably Code 39.
Note that the start or stop pattern in I 2 of 5 is not unique and can easily be found in the symbol itself, making this code vulnerable to short scans. The red line below represents a laser beam from a scanner going across an I 2 of 5 symbol:
The laser exits on a wide and narrow bar pattern that could be interpreted as a stop code, resulting in a short scan. You’ll often see I 2 of 5 printed with bars above or below the code, called bearer bars, to prevent short scans.
Most scanners can be set to read I 2 of 5 as fixed length codes, preventing the short scan issue. Here’s a tip: To find out how many characters are in an I 2 of 5 symbol, count the number of bars, subtract 4 (for start/stop) and divide by 2.5. For example, the symbol with the red line through it about has 24 bars, so 24 – 4 = 20, divided by 2.5 gives you 8.
Another method of eliminating short scans is to enable a check digit in I 2 of 5. Always enable a check digit if you are going to read variable length I 2 of 5 symbols.
I’ll cover Code 39 and Code 128 in more detail later.