Standards/matrix-2-of-5
Matrix 2 of 5
Overview
Matrix 2 of 5 (also Code 2 of 5 Matrix, 2 of 5 Matrix) is a discrete, variable-length, two-width linear barcode that encodes only the digits 0–9 12. It belongs to the "2 of 5" family: each digit is five elements, two wide and three narrow 9. Unlike Industrial 2 of 5 (Barcoder's Standard 2 of 5), it puts those five elements in three bars and two spaces, so the spaces carry data too, and each digit is followed by a narrow inter-character gap 112. The code was devised by the Dutch instrument maker Nieaf 245. No standards body has published a specification for it; what is known comes from 1980s–1990s bar-code handbooks and from vendor and open-source encoder documentation.
The name is not used consistently. Zint and OkapiBarcode call this symbology "Standard Code 2 of 5" (Zint's BARCODE_C25STANDARD, with BARCODE_C25MATRIX as an alias), while Barcoder, Wikipedia and BWIPP reserve "Standard 2 of 5" for the bars-only Industrial 2 of 5 1516171. Zint's manual warns that "the names given to these standards alter from one source to another" 15.
History
Four handbooks attribute the code to the Nieaf Company in the Netherlands: Harmon and Adams (1984), Allais (1985), Palmer (1989 and 1991) and Nelson (1997) 2345. Allais, Palmer and Nelson each describe Matrix 2 of 5 as "a variation of Code 11" (Code 11) devised by Nieaf, "limited to the ten digits and start/stop character" 245. A 2006 Japanese handbook repeats the Nieaf attribution 6.
Nelson's catalogue entry lists the inventor as Sjoerd Wouda and the sponsor as Nieaf-Smitt B.V. of Utrecht 5. A 1950 issue of De Ingenieur names a Sjoerd Wouda (1879–1949) as delegated commissioner and board member of N.V. Nederlandse Instrumenten- en Electrische Apparatenfabriek "NIEAF" 7. No source read for this report says whether they are the same person, or names who designed the code. In 1990 the trade press described Nieaf-Smitt as "a producer of electronic measuring instruments" 8.
Wikipedia dates the code to the 1970s, citing Nelson 1. The Nelson snippets available online do not show a year, and no other source read gives one. Seagull Scientific dates the 2 of 5 family as a whole to 1968 9. No source names the first user or the date of first deployment.
Technical specification
| Parameter | Value |
|---|---|
| Character set | Digits 0–9 only 19 |
| Length | Variable. Zint accepts up to 112 digits; BWIPP rejects input over 500 characters 1512 |
| Elements per digit | 5 (bar, space, bar, space, bar), 2 wide and 3 narrow, then a narrow inter-character space 112 |
| Discrete | Yes 12 |
| Self-checking | "Discrete but not self-checking" (Palmer) 2; Zint's manual calls the whole family self-checking 15 |
| Check digit | Optional; modulo 10 with weights 3/1 129 |
| Start / stop | Both wide bar + four narrow elements (WNNNN) 112 |
| Wide:narrow ratio | Wikipedia: "from 1/3 to 2/5" 1; BWIPP and Zint draw 3:1 1216 |
| Quiet zone | 10X each side, per Wikipedia 1. Seagull lists the quiet zones but gives no size 9 |
Digit patterns. The first four elements carry the weights 1, 2, 4 and 7, and the digit is the sum of the two weights marked wide. The fifth element is a parity bit that makes the wide count exactly two. Zero is the pattern 4 + 7 = 11, which is read as 0 1:
| Digit | Elements (bar–space–bar–space–bar) | Weights |
|---|---|---|
| 0 | N N W W N | 4 + 7 |
| 1 | W N N N W | 1 + parity |
| 2 | N W N N W | 2 + parity |
| 3 | W W N N N | 1 + 2 |
| 4 | N N W N W | 4 + parity |
| 5 | W N W N N | 1 + 4 |
| 6 | N W W N N | 2 + 4 |
| 7 | N N N W W | 7 + parity |
| 8 | W N N W N | 1 + 7 |
| 9 | N W N W N | 2 + 7 |
BWIPP's table and Zint's C25MatrixTable hold the same ten patterns as module widths, each with a trailing one-module gap. Digit 0, for example, is 113311 1216. At 3:1 each digit is therefore 10 modules wide. An Industrial 2 of 5 digit, with its five bars separated by narrow spaces, is 14 1216.
Start and stop. BWIPP draws the start as 311111 and the stop as 31111: a three-module bar, then narrow elements 12. Zint draws a four-module bar there (411111 / 41111) 16. The two encoders therefore produce slightly different start and stop widths for the same data.
Check digit. Wikipedia gives the mod 10/3 formula with the rightmost data digit weighted 3. Its example 423456 gets check digit 2 (weighted sum 48), giving 4234562 1. BWIPP computes the same weighting and takes a final modulo 10, so a sum ending in 0 yields check digit 0 12. Zint uses its standard GS1 check-digit routine 16. Palmer describes the code as "used with a single modulo 10 check digit" 2. Since nothing in the symbol says whether a check digit is present, a reader has to be configured for it. Zebra and Honeywell scanners both ship with check-digit verification off 1922.
Density. Wikipedia calls the density moderate, with symbols about 11% longer than Interleaved 2 of 5 and 82% longer than Code 128 1. Nelson's catalogue gives a maximum density of 15 characters per inch 5. The playground sample 01234567 renders at 95 modules in bwip-js: an 8-module start, 80 modules of data and a 7-module stop. The same data in Industrial 2 of 5 is 131 modules. Verified locally with bwip-js 4.11.0.
Use cases
- Warehouse sorting and photo finishing. Seagull Scientific names these two as the main uses 9. Wikipedia and DevExpress add airline ticket marking 125. Zint describes the symbology as "used in industrial applications and photo development" 15.
- Postal sorting (Datalogic variant). The Datalogic 2 of 5 variant, which uses the same digit patterns, is described as used by the Chinese postal service to sort mail 101. Zint also calls it "China Post" or "Hong Kong 2 of 5" 15.
None of these sources names a specific company, site or date of deployment. Accusoft's documentation says the code "is not widely used" 24.
Implementations
Encoders
- BWIPP / bwip-js. The encoder is
matrix2of5. It is a thin wrapper that calls BWIPP'scode2of5withversion=matrix1312. Options areincludecheck(append the mod 10 check digit),includecheckintext(show it in the human-readable text),validatecheck(treat the last digit as a check digit and reject a wrong one) andincludetext1112. BWIPP's own example is01234567withincludetext includecheck includecheckintext1113. bwip-js listsmatrix2of5alongsidedatalogic2of5,coop2of5,iata2of5,industrial2of5andinterleaved2of514. Non-digit input stops with "Code 25 must contain only digits" 12. - Zint (C).
BARCODE_C25STANDARD(2), aliasBARCODE_C25MATRIX, takes up to 112 digits.--vers=1adds a check digit;--vers=2adds it but hides it from the text 1516. - OkapiBarcode (Java). Mode
ToFMode.MATRIX("Standard Code 2 of 5 mode, also known as Code 2 of 5 Matrix") is the default mode of itsCode2Of5class 17. - Commercial SDKs. DevExpress's Office File API has a
Matrix2of5generator withCalculateChecksumandWideNarrowRatiooptions 25. Accusoft Barcode Xpress also supports the symbology 24.
Decoders
- No open-source decoder found. ZXing's
BarcodeFormatlist has ITF but no Matrix 2 of 5 27. zxing-cpp's supported-formats table lists ITF, Codabar and others but no Matrix 2 of 5 26. ZBar reads "Interleaved 2 of 5" but no other 2 of 5 code 28. - Hardware scanners.
- Zebra: Matrix 2 of 5 is parameter 618 and disabled by default. The check-digit setting (622) is also off by default 1819. Zebra's EMDK
Matrix2of5decoder class exposeslength1/length2(0–55),redundancy("read the barcode twice before accepting data"),reportCheckDigitandverifyCheckDigit20. - Honeywell: the Voyager 1250g guide sets Matrix 2 of 5 Off by default, with message lengths 1–80 (defaults 3 and 80). Its check-character options are "No Check Character" (the default), "Validate, but Don't Transmit" and "Validate and Transmit" 2122.
- Zebra: Matrix 2 of 5 is parameter 618 and disabled by default. The check-digit setting (622) is also off by default 1819. Zebra's EMDK
- Platform APIs. Windows' point-of-service API defines
BarcodeSymbologies.TfMat, "the 2 of 5 Matrix barcode symbology" 23. - Wikipedia states that "most barcode readers support this symbology" 1. The Zebra and Honeywell guides show that support exists but has to be switched on.
Comparison
All of the following are numeric-only 2 of 5 codes. The element tables are from BWIPP's code2of5 and Zint 1216.
| Symbology | Digit patterns | Start / stop (modules) | Notes |
|---|---|---|---|
| Standard 2 of 5 (Industrial) | 5 bars, data in bars only, 14 modules | 313111 / 31113 |
Spaces fixed and narrow 1 |
| IATA 2 of 5 | Industrial patterns | 1111 / 311 |
Same data as Industrial, different start/stop |
| Matrix 2 of 5 | 3 bars + 2 spaces, 10 modules | 311111 / 31111 |
Discrete, odd digit counts allowed 1 |
| Datalogic 2 of 5 | Matrix patterns | 1111 / 311 |
Wikipedia: differs from Matrix "only in start/stop patterns" 1 |
| COOP 2 of 5 | Matrix patterns, assigned to different digits | 3131 / 133 |
BWIPP gives the alias NEC 2 of 5 11 |
| ITF | Digit pairs interleaved in bars and spaces | — | Even digit count only; Zint adds a leading zero to odd input 15 |
- vs Industrial 2 of 5. Matrix 2 of 5 puts data in the spaces as well as the bars. A digit takes 10 modules instead of 14, so the code is denser 112.
- vs Interleaved 2 of 5. ITF is continuous, with no inter-character gap, and is about 11% shorter 1. Wikipedia names the "main advantage" of Matrix 2 of 5 over ITF as encoding an odd number of digits 1. ITF can only encode digit pairs, and Zint pads odd input with a leading zero 15.
- vs Datalogic 2 of 5 and NEC/COOP 2 of 5. These share the Matrix element structure and differ in start/stop codes and, for COOP, in which pattern stands for which digit 121. Hiramoto describes NEC 2 of 5 as structurally similar to Matrix 2 of 5 but with a different start code 6. A reader set for one will not read the others.
- Choosing. Allais (1985) and Palmer (1989) judged that Matrix Two of Five "is somewhat more subject to substitution errors and offers no particular advantage" 43. Unlike ITF, which Zint documents under ISO 16390, Matrix 2 of 5 has no published specification 15.
Conflicting vendor descriptions. DevExpress says Matrix 2 of 5 "encodes all information in bars, while spaces have a fixed width and act as separators" 25. That describes Industrial 2 of 5 and contradicts Wikipedia and the BWIPP and Zint tables, in which spaces take wide elements 11216. Accusoft calls Matrix 2 of 5 "similar to DataLogic 2 of 5 with a checksum character" 24. The encoder tables show the two differ in their start and stop patterns, and in both the check digit is optional 1216.
Fun facts
- Zero is an overflow. With weights 1, 2, 4 and 7, no pair of weights sums to 0, so zero borrows the pattern for 4 + 7 = 11 1.
Status
Legacy, with no specification. No ISO, AIM or industry specification for Matrix 2 of 5 was found. The handbooks of the 1980s and 1990s are the closest thing to a definition 245. The code is still maintained in open-source encoders: BWIPP's wiki page was last edited on 17 Oct 2026, and Zint's July 2026 manual (version 2.16.0.9) documents it 1115. Zebra's RS6100 and Honeywell's Voyager 1250g scanners decode it once it is enabled 1821. No major open-source decoder reads it 262728, and Accusoft calls it "not widely used" 24. No source names a successor; Datalogic 2 of 5 is a variant, not a replacement 1.
Sources
Deployments
No country reports mention this standard by name.
Regions / aggregations not mapped to a single country
- Universal