There are dozens of different standards when it comes to barcodes, and each of them has their own rules as to how they are worked out.
Some of them have checksum digits worked in. Some have parity, whereby alternate digits used different sets of data to output the bars, some work on fixed sized data, whereas others are variable, but they all have one thing in common.
They all are made up of a sequence of bars and spaces, where, based on the rules of the barcode being used, a digit is represented by a particular set of bars and spaces.
Here is the source for an application I have written in C# which calculates the encoding for various barcode formats and outputs the resulting barcode as an image.
The program currently encodes EAN-13, EAN-8, UPC-A, UPC-E, UPC-2, UPC-5, MSI, Postnet, Standard 2 of 5 and Interleaved 2 of 5. The most commonly found barcodes are the EAN-13 and UPC-A barcodes which are commonly found on most household goods.
I will cover the algorithms used to create each barcode in future blog posts, but for now, enjoy playing around with this app
Comments