Standards/two-track-pharmacode
Two-Track Pharmacode
Overview
Two-Track Pharmacode is the two-track member of Laetus's PHARMA-CODE family of packaging-control codes. One-track Pharmacode varies bar width. The two-track form varies the vertical position of the bars instead: each bar is a short bar above the midline, a short bar below it, or a full-height bar 1, 9. It encodes a single integer up to 64,570,080, far more than one-track Pharmacode's 131,070 1, 3. Pharmaceutical packaging lines use it to check that printed packaging materials match the product, not to identify items in trade 7.
History
PHARMA-CODE is a Laetus trademark. Laetus describes the family as "older than UPC" and as "preventing intermixture for over 50 years" 2. Zint's source names the Laetus Pharmacode Guide as the defining document for the two-track variant. Zint describes its own algorithm as "a modified algorithm from the One Track system" 4. No fetched source dates the two-track variant itself.
Technical specification
- Symbol structure. The symbol is a row of evenly spaced bars on two tracks. The information is "contained in the vertical position of the bars" 9. Short bars can appear above or below the midline, together with full bars 1.
- Encoding algorithm. Zint's
pharma_two_calcrepeatedly divides the value by 3. A remainder of 1 emits digit 1 and subtracts 1, a remainder of 2 emits digit 2 and subtracts 2, and a remainder of 0 emits digit 3 and subtracts 3, so each digit is between 1 and 3. The digits are then read in reverse 4. Digit 2 sets the top track, digit 1 the bottom track, and digit 3 both, giving a full bar. Bars sit two modules apart, so the symbol is 2 rows high and 2n − 1 modules wide for n bars 4. Reading the bars as base-3 digits, most significant first, gives the value back. - Value range. Zint, BWIPP and DataFlex give 4 to 64,570,080 4, 7, 8. The BarTender guide gives a minimum of 3 1, and Zint's tests reject 3 as out of range 5. The maximum is 16 full bars: 3 × (3¹⁶ − 1) / 2 = 64,570,080. The minimum of 4 is two short bottom bars. Both were checked by running the algorithm.
- Length. Input is digits only, at most 8 digits 4. No check digit is included 1, 9.
- Reading and quiet zone. The code is read right to left 1, 2. A quiet zone of 6 mm is needed on each side 1.
- Height. Zint quotes the Laetus Pharmacode Guide 1.4 for the two-track height: at least 8 mm, with an X-dimension between 0.8 mm and 2 mm 4. BWIPP's
heightoption sets each track's height, so a full bar is twice as tall. The default is 4 mm per track 7.
Worked examples
| Value | Bars, left to right (B = short bottom, T = short top, F = full) | Source |
|---|---|---|
| 117480 | B T T T B T F F T F F (11 bars) | BWIPP example value 7. Pattern computed with Zint's algorithm 4. |
| 29876543 | 16 bars. Top row 0010100010001010001010001000101, bottom row 1000101010100000100000101010000 |
Zint test vector, "verified manually against TEC-IT" 5 |
| 64570080 | 16 full bars | Zint test vector 5 |
For the Barcoder playground default (117480), bwip-js's pattern was checked against Zint's algorithm bar by bar, and against bars read off the rendered PNG. Both gave the same 11 bars as the table above. bwip-js also reproduces Zint's TEC-IT-checked rows for 29876543 exactly.
Use cases
- Packaging-line verification. Laetus describes PHARMA-CODE as a closed-loop code that ensures packaging accuracy and prevents mix-ups of pharmaceutical product and packaging 2. BWIPP lists its use as "checking the printed packaging materials of pharmaceuticals on packaging lines, rather than identifying an item in trade" 7.
- Colour-coded inserts. Laetus notes that printing PHARMA-CODE in a range of colours lets a line check that a package holds the right colour-coded insert 2.
- Larger number ranges. The two-track variant is the one to pick when a line needs codes above the one-track ceiling of 131,070 1, 3.
Implementations
- Zint (C, 820 stars, last push Oct 2026) implements Pharmacode Two-Track (
BARCODE_PHARMA_TWO, symbology 53) inbackend/medical.c4, 6, 10. - BWIPP (PostScript, 504 stars, last push Oct 2026) provides the
pharmacode2encoder 7, 12. - bwip-js (JavaScript, 2,424 stars, last push Aug 2026) is the JavaScript port of BWIPP that Barcoder's playground uses 11.
- Commercial SDKs. BarTender, DataFlex Reports and activePDF Toolkit document the symbology 1, 8, 9.
No open-source decoder for two-track Pharmacode was found, and ZXing does not read it. Laetus notes that reading any PHARMA-CODE needs a decoder to turn the scanned binary pattern into a number 2.
Fun facts
- Laetus warns that scanning a PHARMA-CODE left to right instead of right to left "produces a different result" 2.
- Zint's test vectors for two-track Pharmacode were checked by hand against another vendor's generator (TEC-IT) 5.
Comparison
- Versus one-track Pharmacode. One-track uses narrow and wide bars on a single track and ranges from 3 to 131,070. Its maximum is sixteen wide bars 3. Two-track uses short-top, short-bottom and full bars, reaching 64,570,080 with sixteen full bars 1, 4. Both omit a check digit and need a 6 mm quiet zone 1, 3. Choose one-track for small product numbers. Choose two-track when the number range must exceed 131,070.
- Versus Code 32 and PZN. These identify medicines in national systems. Pharmacode is a closed-loop production-line check rather than an identifier in trade 2, 7.
Status
Active. Two-track Pharmacode is still supported by maintained encoders, with Zint and BWIPP both updated in October 2026 10, 12, and Laetus still documents the PHARMA-CODE family 2.
Sources
Deployments
No country reports mention this standard by name.
Regions / aggregations not mapped to a single country
- Universal