Barcode 401: How do Barcodes Work?
If you refer to all barcodes as UPC’s, this article won’t be interesting to you. But if you know that all barcodes are not UPC’s, it may interest you to know that different symbologies encode the data very differently, and I’m not talking about how the data itself is arranged: that’s a different sort of difference. To be clear, we are talking about 1D or linear barcodes only; 2D or matrix symbologies are a whole different animal.
At a very basic level, there are two types of barcodes: discrete and continuous. Discrete barcodes encode each character, whether an alphabetical character or a numerical character, well, discretely: clever description, eh? In other words, each character is its own little bar and space arrangement which is separated from the next encoded character by a non-intelligent (containing no information) space, called an inter-character gap.
All bar-space combinations in continuous barcodes are meaningful: there are no dumb elements (space). Continuous barcodes are, in this way, more efficient that discrete barcodes.
Barcodes encode data in elements (bars and spaces) of different widths. Some barcodes use only two widths—narrow and wide—to accomplish data encoding. These are called binary symbologies. The wide element is a fixed multiple of the narrow element width. Other barcodes utilize elements of three or four different widths, based on a common building block or module: these are called modular symbologies.
Another major distinguishing characteristic of barcodes is whether they are fixed or variable length; the description says it all.
These are the basic distinctions in linear barcodes. From here the differences between symbologies get much more complicated and individualized. Here are some examples:
Code 39 is a discrete, binary, variable length barcode with the ability to encode numbers 0 through 9 and 29 upper case only alphabetical letter, plus a few special characters. Code 39 is said to be the most widely used barcode in the world according which is counterintuitive considering all the UPC marked retail products in the global marketplace.
Data is encoded in nine elements (bars and spaces), three of which are wide and the remaining six are narrow. The name Code 39 derives from this encoding scheme.
UPC is a continuous, modular, fixed length barcode; it encodes numerical characters only.
Data is encoded in four elements: two bars and two spaces.
Code 128 is a continuous, modular, variable length barcode with the ability to encode the entire 128 character ASCII keyboard (but that is not how it got its name. For that information, see link).
Code 128 encodes data in a combination of 6 bars and spaces (except for the check digit which is encoded in 7)
Code 128 has three distinct data sets, A, B or C, which are defined by a prefix (A, B or C). Version A can encode numbers 0 through 9, alphabetical characters A through Z (upper case only), and a set of special characters such as @, #, $, %, etc. Version B encodes the same special characters as A, 0-9 and the full alphabet in upper and lower characters. Version C encodes numerical only, and encodes them in pairs using the same 6 bars and spaces. This makes Version C very space-efficient in numerical only data needs to be encoded.
ITF14 is a continuous, binary, fixed length barcode which encodes numerals 0-9 only.
Data is encoded in five elements, two of which are wide. This accounts for the ‘TF’ (two of five) part of the naming scheme. The ‘I’ (interleaved) part of the name describes a very unique assembly of the bars and spaces: data encoded in the odd (first, third, fifth, etc.) positions in the barcode are encoded in bars only (two of them wide, three of them narrow). Data encoded in the even (second, fourth, sixth, etc.) positions in the barcode are encoded in spaces only (two of them wide, three of them narrow). Since encoded data is paired in this way, ITF14 must encode an even number of characters, and as the name also implies, that number is limited to 14 characters.