Code 2-of-5 Barcode Explained
Code 2-of-5 was one of the earliest linear barcode symbologies, originally introduced in the 1970s. The barcode is sometimes also referred to as Code 25 or Code 2/5. Several versions of Code 2-of-5 were developed over the years, the most important are Code 2-of-5 Standard (sometimes also called "Industrial") and Code 2-of-5 Interleaved. Only the latter ("Interleaved") is still in use; the "Standard"-version has fallen out of favor, mostly because it's not very efficient, see next paragraph. The term "two of five" originates from the fact that an individual symbol has five bars, two of which are wide.
The Interleaved version gets its name from the fact that each symbol encodes a pair of numbers; the first digit is encoded into the "bars" of a symbol, the second into the "spaces". This makes for a very compact code, even for larger amounts of data (the data density is comparable to Code 128 Type C which also features numeric compaction).
Here's an example of Code 25 Standard (module width 0.5mm):
Compare to Code 2-of-5 Interleaved with same settings and data:
Code 2-of-5 at a Glance
Note: Since only even amounts of digits can be encoded into an "Interleaved" barcode, it's common practice to either prepend a "0" or append a check digit if the data consists of an odd number of digits.
Code 2-of-5 maximum length
Code 2-of-5 is a variable length code, which in principle can encode an arbitrary length of data. The practical content limit is at around 30 digits before the code gets too wide.
Code 2-of-5 Interleaved with 30 digits, module width 0.4mm, total length c. 115mm (click for full size):
Note that many barcode scanners or reader apps may have soft limits below those numbers. Also, a barcode must not be wider than the "reading window" or aperture of a scanner or it won't be scanned.
Code 2-of-5 Bit Pattern
Start / stop characters:
Check digit calculation for Code 2-of-5
Code 2-of-5 (that goes for both variations) uses a Modulo 10 check digit algorithm which is identical to the calculation used for UPC-A and EAN 13. All digits are multiplied by 1 and 3 (alternating), added up and then modulo divided by 10. The reminder is subtracted from 10, the result is the checkdigit.
The barcode software that generates the code will usually calculate the check digit automatically if needed. Depending on the application the check digit may or may not be part of the humand readable text line.
Decoding Code 2-of-5
Manually decoding Code 2-of-5 is possible, beginning with the start symbol and going forward one character or pair of digits at a time. Afterwards, the validity of the decoded data has to be verified against the Modulo 10 check digit if present.
Code 2-of-5 fonts for Excel or Google Sheets
Code 2-of-5 Interleaved is a good choice for embedding barcodes with purely numeric data in your spreadsheet. Applications include catalogs with article numbers, serial numbers, personnel IDs or similar data. The easiest and most straight forward way of creating Code 2-of-5 barcodes in Excel or Google Sheets is with a Code 25 barcode font. In order to convert the data into pairs, add the required start/stop symbols and calculate the check digit, such a barcode font can only be used in conjunction with an add-in, for example the Softmatic barcode add-in for Excel.
Note, that it is not sufficient to simply select the cell with your data and change the font to "Code 2/5" (a common misconception with 2-of-5 barcode fonts that are freely available on the net).
Create Code 2-of-5 in Illustrator, InDesign
Easy to use barcode plug-ins and extensions for Adobe InDesign, Illustrator und Photoshop. For more videos, see the Softmatic Youtube Channel
The Softmatic barcode plug-ins and extensions for InDesign, Illustrator and Photoshop are available on the Adobe Exchange.
Code 2-of-5 GeneratorSoftmatic BarcodePlus V5 creates Code 25 Standard and Code 25 Interleaved will export the barcode as PDF / SVG (resolution-independent vector) oder raster image (PNG, TIFF):
Code 2-of-5 Bulk Barcode Generator
For creating Code 2-of-5 Standard and Code 2-of-5 Interleaved in bulk, use Softmatic BarcodeFactory V5. The software will create thousands of barcode symbols in seconds, with data coming from the built-in serial number generator, the clipboard or via import from Excel, Numbers or CSV text files:
Code 128 REST APIs