Code 25 Explained

Code 25 Example

Code 25 was one of the earliest linear barcode symbologies, originally introduced in the 1970s. The barcode is sometimes also referred to as Code 2-of-5 or Code 2/5. Several versions of Code 25 were developed over the years, the most important are Code 25 Standard (sometimes also called "Industrial") and Code 25 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):

Code 25 Standard Example

Compare to Code 25 Interleaved with same settings and data:

Code 25 Interleaved Example

Code 25 at a Glance

  • Type: Linear barcode symbology
  • Applications: Warehousing, transport, logistics, ITF-14
  • Character set: Digits 0-9
  • Modes: n/a
  • Check digit: Modulo 10 (not mandatory but recommended)
  • Generators: Stand-alone, barcode fonts, barcode extensions
  • Scanning: CCD / Laser scanners, imagers, scanner apps
  • Printing: Thermal direct, thermal transfer, laser, inkjet, dot-matrix

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 25 maximum length

Code 25 is a variable length code, which in principle can encode an arbitrary length of data. The practical content limit with the "Interleaved" variant is at around 30 digits before the code gets too wide.

Code 25 Interleaved with 30 digits, module width 0.4mm, total length c. 115mm (click for full size):

Code 25 maximum length

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 25 Bit Pattern

The Code 25 bit pattern (JavaScript array syntax) for the digits 0-9. Five elements for bars and spaces; '0' is a narrow element, '1' is a wide element.

const c25_bp =
[
  ['0','0','1','1','0'],
  ['1','0','0','0','1'],
  ['0','1','0','0','1'],
  ['1','1','0','0','0'],
  ['0','0','1','0','1'],
  ['1','0','1','0','0'],
  ['0','1','1','0','0'],
  ['0','0','0','1','1'],
  ['1','0','0','1','0'],
  ['0','1','0','1','0']
];

Start / stop characters:

const c25_start =
[
  '0','0','0','0'
];

const c25_stop =
[
  '1','0','0'
];

Check digit calculation for Code 25

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 25

Manually decoding Code 25 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 25 fonts for Excel or Google Sheets

Code 25 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 25 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 25 in Illustrator, InDesign

The Softmatic Barcode Extensions for ILlustrator and InDesign support Code 25 Interleaved and 25 Standard/Industrial.

The barcode plug-ins are very to use and create stanard compliant codes directly in your AI or ID document. 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 25 Generator

Softmatic 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 25 Barcode Generator

Code 25 Bulk Barcode Generator

For creating Code 25 Standard and Code 25 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: