Pharmacode is a one-track bar code of 2 to 16 narrow and wide bars that stores a number from 3 to 131,070 in binary. Positions are counted from the right: a narrow bar at position n adds 2^n, a wide bar adds 2 x 2^n, and the sum of all bars is the code value.
What is pharmacode?
Pharmacode is a one-track bar code, also called the Laetus code or pharmaceutical binary code. It is used on packing materials to confirm the identity of a carton, label or leaflet. The main job of pharmacode is to confirm that the right carton, label or leaflet is in use. A mismatch stops the line or diverts the pack, so it works as a packing-control code that helps prevent or detect mix-ups and printing errors.
Pharmacode is not an anti-counterfeiting or serialization code. Unique identification of each pack uses a GS1 Data Matrix, as described in the IntuitionLabs guide to pharmaceutical serialization.
Range and number of bars
Pharmacode stores its number in binary, as bar widths, not as decimal digits. The bars therefore cannot be read as printed digits, and a reader or a calculation is needed to get the value.
The Laetus specification, as reproduced in the BarTender symbology help for PHARMA-CODE One-Track, gives the range as 3 to 131,070 with 2 to 16 bars. The lowest value is 3, which is two narrow bars (1 + 2). The highest value is 131,070, which is sixteen wide bars: 2 x (2^16 – 1).
How to calculate a pharmacode value
A pharmacode is made of two bar types, narrow and wide, and its value is found by numbering the bar positions and adding the weight of each bar.
- Number the positions 0, 1, 2 and so on, starting from the right.
- A narrow bar at position n adds 2^n.
- A wide bar at position n adds 2 x 2^n.
- The code value is the sum of all the bars.


Worked example
In this example the bars are read from right to left, so position 0 is the rightmost bar.
| Position | Bar type | Formula | Value |
|---|---|---|---|
| 0 | Narrow | 2^0 | 1 |
| 1 | Wide | 2 x 2^1 | 4 |
| 2 | Narrow | 2^2 | 4 |
| 3 | Wide | 2 x 2^3 | 16 |
| 4 | Wide | 2 x 2^4 | 32 |
| 5 | Wide | 2 x 2^5 | 64 |
Adding all the values gives 1 + 4 + 4 + 16 + 32 + 64 = 121, so the code value is 121.
Same bars read from the other end
When the same bars are read from the opposite end, the old leftmost bar becomes position 0, and the pattern is then wide at positions 0, 1 and 2, narrow at 3, wide at 4 and narrow at 5. This gives 2 + 4 + 8 + 8 + 32 + 32 = 86. The same print therefore gives 121 in one direction and 86 in the other.
Related Post:Pharma packing questions/answer for the interview
Scanning direction and no start or stop character
Pharmacode has no start or stop character, so the direction set on the reader decides the value. Reading the same bars the other way can give a different number, as the example above shows.
The pictures in this post show a machine reading from the left. The standard reading direction is right to left: the rightmost bar is position 0 with the lowest value, and the leftmost bar has the highest weight. The first bar read has the highest value, as in a decimal number, only when the reader scans from left to right, which is not the standard direction. Omnidirectional scanners can also read the code from left to right. Because the reading direction changes the value, this must be considered while designing packaging materials.
Bar dimensions and possible code combinations
The table below shows the bar dimensions of the code. Under the Laetus specification, print should be high-precision, and Zebra’s Aurora Focus guide adds that the code needs high contrast and a clear quiet zone.

The image below shows the number of possible code combinations.

What is the Thin bar width?
0.5 ± 0.1mm for minimum ±0.2 mm for maximum is widely accepted in Pharmaceuticals
Benefits and limits of pharmacode
Pharmacode helps the packing line, but it has clear limits.
- The code is a Binary number, not a decimal one, so the bars cannot be read as printed digits.
- Pharmacode is used to prevent mix-ups of cartons, labels and leaflets.
- Binary encoding does not make the code secure, so pharmacode must not be treated as protection against counterfeiting.
Critical parameters of pharmacode
The table lists the parameters that decide whether a pharmacode is issued and read correctly.
| Parameter | Typical setting or range | Why it matters | How it is monitored |
|---|---|---|---|
| Value range | 3 to 131,070 | Defines the codes that can be issued | Controlled list of values |
| Number of bars | 2 to 16 | Sets the largest value the code can hold | Check of the artwork |
| Reading direction | Set on the reader, no value | Decides the value read from the bars | Reader setting at start-up |
| Reference code | Value of the product, carton or leaflet | A wrong reference rejects good packs or passes wrong ones | Recorded at start-up |
| Read-back match level | 0 to 100, threshold set by the plant | A falling level can warn of print head wear or focus drift | Reader log |
READ ALSO
Weighing Balance Tolerance Limit Calculation with Example
The Weighing Balance Tolerance Limit of a pharmaceutical weighing machine refers to the maximum acceptable…
Choosing a pharmacode for a new product
A new value must be chosen so that two different packing materials never carry the same or a confusable code. The points below apply.
- Use at least three bars and mix wide and narrow bars, because a code of one bar width is not secure.
- Give each product, carton and leaflet a different value.
- Keep a controlled list of pharmacode values.
- Compare the reversed pattern with the list of codes in use, because a code that reads as another valid value when reversed can cause a mix-up.
Pharmacode vs Data Matrix and serialization
Pharmacode is an in-house one-track code for packing-material identity and mix-up prevention. Serialization under the EU Falsified Medicines Directive and the US Drug Supply Chain Security Act (DSCSA) uses a GS1 Data Matrix (ISO/IEC 16022, ECC 200) that carries the product code, serial number, batch and expiry.
A pack can carry both codes, and the Data Matrix does not replace the pharmacode. Keyence describes AI code readers that capture a pharmacode and a Data Matrix in one read by using parameter banks. 2D Pharmacode is a Data Matrix-based symbology created to replace the linear code where space is short.
Pharmacode reader on the packing line
A pharmacode reader checks each carton, label or leaflet against the reference code. On cartoning lines, networked cameras check each carton for the correct leaflet and pharmacode, send a pass or fail signal to the line programmable logic controller (PLC), and trigger the reject mechanism when the code does not match. The detailed procedure is in the Standard Operating Procedure (SOP) titled SOP on operation of the pharmacode reader.
Our Focus guide gives these points for reliable reading:
- Enable only the pharmacode symbology on the reader.
- Keep high contrast and a clear quiet zone.
- Avoid glare and use sharp images.
- Print with high precision, to the Laetus specification.
- Add software checks on the code length or the value range.
At start-up the work goes in this order:
Take line clearance from the in-process quality assurance (IPQA) officer, and remove all packing material of the previous product from the line.
Set the reading direction on the reader and place the sensor so that it sees the code on every pack.
Enable only the pharmacode symbology, and enter the reference code of the product, carton or leaflet.
Run a challenge test with a wrong code. The reader must send the reject signal to the PLC and the line must reject the pack.
The IPQA officer verifies the setting and records the reference code in the batch packing record (BPR).
Under 21 CFR 211.130, the US FDA requires the following for packaging and labeling operations, and a pharmacode reader supports these checks:
- Written packaging and labeling procedures.
- Inspection of packaging and labeling materials before use.
- Inspection of the packaging area immediately before use, to confirm that earlier products and materials are removed.
Another packaging calculation is given in How to Calculate Blister Machine Foil/ Formula.
Troubleshooting false rejects and no-reads
The table gives the usual causes of rejects and no-reads on a pharmacode reader and the action for each.
| Problem | Cause | Action |
|---|---|---|
| No-read | Glare on the pack | Change the lighting angle or reader position |
| No-read | Low contrast | Improve the print contrast and keep the quiet zone clear |
| False reject | Print defect | Stop the line and inform the production officer to correct the print |
| False reject | Wrong reading direction | Set the direction used in the artwork |
| Good pack rejected | Wrong reference code | Enter the correct reference code and let IPQA record it |
| No-read | Dirty lens | Clean the lens |
| Intermittent no-read | Loose sensor position | Fix the sensor in the position used at start-up |
Frequently Asked Questions
Can pharmacode be read in both directions?
Pharmacode has no start or stop character, so a reader reads it in one set direction. The same bars read from the other end can give a different value, as the worked example shows (121 and 86). The reading direction must therefore be set on the reader and matched to the artwork.
Is pharmacode the same as a barcode?
Pharmacode is a type of one-track bar code, but it differs from retail codes such as EAN. It has no start or stop character. It stores one integer in binary as narrow and wide bars, so the value must be calculated or read by a reader instead of being printed as digits.
Can a pharmacode be printed in colour?
Yes. optional colour bars can be added to a pharmacode, and they do not carry data. The reader still needs good contrast to read the code, and keep high contrast and a clear quiet zone for reliable reading.
What is 2D Pharmacode?
2D Pharmacode is a Data Matrix-based symbology created to replace the linear PHARMA-CODE where space is short. The linear code is a row of narrow and wide bars read in one set direction, whereas a Data Matrix is a two-dimensional symbol. The bar weight calculation applies only to the linear code.
References
Pharmacode, Wikipedia
PHARMA-CODE One-Track, Seagull Scientific (BarTender help)
Best Practices for Using Pharmacode, Zebra
Read-Back Verification at the Marking Station, Keyence
Pharmaceutical serialization and the Falsified Medicines Directive, IntuitionLabs
2D Pharmacode, Seagull Scientific (BarTender help)