"3 of 9" (also known as "USS Code 39", "Code 3/9", "Code39" , "USD-3", "Alpha39") is a barcode symbology that can encode uppercase letters (A through Z), digits (0 through 9) and a handful of special characters like the $ sign.

 

The barcode itself does not contain a check digit (in contrast to—for instance—Code 128), but it can be considered self-checking by some, on the grounds that a single erroneously interpreted bar cannot generate another valid character. Possibly the most serious drawback of Code 39 is its low data density: It requires more space to encode data in Code 39 than, for example, in Code 128.

 

This means that very small goods cannot be labeled with a Code 39 based barcode. However, Code 39 is still widely used and can be decoded with virtually any barcode reader.

 

The name Code 39 is derived from the fact that three of the nine elements that constitute a codeword are wide elements, the remaining six are narrow. Code 39 was developed by Dr. David Allais and Ray Stevens of Intermec in 1974. It was later standardised as ANSI MH 10.8 M-1983 and MIL-STD-1189.

 

The width ratio between narrow and wide can be chosen between 1:2 and 1:3.

 

Code 39 is sometimes, though rarely, used with an optional modulo 43 check digit. Using it requires this feature to be enabled in the barcode reader. The code with check digit is referred to as Code 39 mod 43.

 

Here is how to do the checksum calculation:

 

  Take the value (0 through 42) of each character in the barcode excluding start and stop codes.
  Sum the values.
  Divide the result by 43.
  The remainder is the value of the checksum character to be appended.