Code 39 (also known as Code 3 of 9, Code 3/9, USS Code 39, Code three of nine, or USD-3) is the first alpha-numeric symbology developed to be used in non-retail environment. It is widely used to code alphanumeric information, such as the model number etc.
Code39 is capable of encoding 26 upper case letters, 10 digits and 7 special characters:
A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 -, ., *, $, /, +, %, SPACE.
It Is called code 39 or three of nine because each character encoded is made up of 5 bars and 4 spaces for a total of 9 elements and 3 out of 9 element are always wide.
A complete code 39 barcode must include a start character * and a stop character *. In this way code 39 is self-checking.
The height of the bars must be at least 0.15 times of the symbol’s length or 0.25 inches, whichever is larger.
Code 39 is a discrete symbology. Two adjacent characters are separated by an inter-character gap. To have the good barcode quality, the width of the inter-character gap usually equals to the width of the narrowest element, called X.
Code39 requires a starting quiet zone with the minimum 10 times of X dimension or 0.10 inch whichever is greater. The same width requirement applies to the trailing quiet zone.
Code 39 Mod 43 — In applications that require very high level of accuracy a modulo 43 check sum digit is appended to the last character. Also known as HIBC and LOGMARS.
Code 39 Extended — this encoding variant allows all 128 ASCII characters to be encoded.
In this variant, a check character is appended to the end of data encoded, using modulo 43 algorithm. To calculate the checksum digit, follow the steps below:
Take the value (0 through 42) of each character in the barcode. The start and stop characters are not included in the checksum calculation.
Sum the value of each of the values of each of the characters described in step 1.
Divide the result from step 2 by 43.
The remainder from the division in step 3 is the checksum character that will be appended to the data message before the stop character.
Table 1. Code39 Character Value Table
char | value | char | value | char | value | char | value |
---|---|---|---|---|---|---|---|
0 | 0 | A | 10 | N | 23 | - | 36 |
1 | 1 | B | 11 | O | 24 | . | 37 |
2 | 2 | C | 12 | P | 25 | SPACE | 38 |
3 | 3 | D | 12 | Q | 26 | $ | 39 |
4 | 4 | E | 14 | R | 27 | / | 40 |
5 | 5 | F | 15 | S | 28 | + | 41 |
6 | 6 | G | 16 | T | 29 | % | 42 |
7 | 7 | H | 17 | U | 30 | ||
8 | 8 | I | 18 | V | 31 | ||
9 | 9 | J | 19 | W | 32 | ||
K | 20 | X | 33 | ||||
L | 21 | Y | 34 | ||||
M | 22 | Z | 35 |
The code 39 symbology can be extended to encode all 128 characters in the ASCII table. In the full ASCII mode, the symbols $ / % and + are used as precedence codes with the 26 letters as shown below. Since the same symbol now can be interpreted as one character in Extended Code 39 mode and two characters in Code 39 mode, the readers must be set to extended mode to read the data correctly. Extended Code39 is sometimes called Code39 Full ASCII.
Val | ASCII | Encoding | Val | ASCII | Encoding | Val | ASCII | Encoding | Val | ASCII | Encoding | |||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | NUL | %U | 32 | [space] | [space] | 64 | @ | %V | 96 | ` | %W | |||
1 | SOH | $A | 33 | ! | /A | 65 | A | A | 97 | a | +A | |||
2 | STX | $B | 34 | " | /B | 66 | B | B | 98 | b | +B | |||
3 | ETX | $C | 35 | # | /C | 67 | C | C | 99 | c | +C | |||
4 | EOT | $D | 36 | $ | /D | 68 | D | D | 100 | d | +D | |||
5 | ENQ | $E | 37 | % | /E | 69 | E | E | 101 | e | +E | |||
6 | ACK | $F | 38 | & | /F | 70 | F | F | 102 | f | +F | |||
7 | BEL | $G | 39 | ' | /G | 71 | G | G | 103 | g | +G | |||
8 | BS | $H | 40 | ( | /H | 72 | H | H | 104 | h | +H | |||
9 | HT | $I | 41 | ) | /I | 73 | I | I | 105 | i | +I | |||
10 | LF | $J | 42 | * | /J | 74 | J | J | 106 | j | +J | |||
11 | VT | $K | 43 | + | /K | 75 | K | K | 107 | k | +K | |||
12 | FF | $L | 44 | , | /L | 76 | L | L | 108 | l | +L | |||
13 | CR | $M | 45 | - | - | 77 | M | M | 109 | m | +M | |||
14 | SO | $N | 46 | . | . | 78 | N | N | 110 | n | +N | |||
15 | SI | $O | 47 | / | /O | 79 | O | O | 111 | o | +O | |||
16 | DLE | $P | 48 | 0 | 0 | 80 | P | P | 112 | p | +P | |||
17 | DC1 | $Q | 49 | 1 | 1 | 81 | Q | Q | 113 | q | +Q | |||
18 | DC2 | $R | 50 | 2 | 2 | 82 | R | R | 114 | r | +R | |||
19 | DC3 | $S | 51 | 3 | 3 | 83 | S | S | 115 | s | +S | |||
20 | DC4 | $T | 52 | 4 | 4 | 84 | T | T | 116 | t | +T | |||
21 | NAK | $U | 53 | 5 | 5 | 85 | U | U | 117 | u | +U | |||
22 | SYN | $V | 54 | 6 | 6 | 86 | V | V | 118 | v | +V | |||
23 | ETB | $W | 55 | 7 | 7 | 87 | W | W | 119 | w | +W | |||
24 | CAN | $X | 56 | 8 | 8 | 88 | X | X | 120 | x | +X | |||
25 | EM | $Y | 57 | 9 | 9 | 89 | Y | Y | 121 | y | +Y | |||
26 | SUB | $Z | 58 | : | /Z | 90 | Z | Z | 122 | z | +Z | |||
27 | ESC | %A | 59 | ; | %F | 91 | [ | %K | 123 | { | %P | |||
28 | FS | %B | 60 | < | %G | 92 | \ | %L | 124 | | | %Q | |||
29 | GS | %C | 61 | = | %H | 93 | ] | %M | 125 | } | %R | |||
30 | RS | %D | 62 | > | %I | 94 | ^ | %N | 126 | ~ | %S | |||
31 | US | %E | 63 | ? | %J | 95 | _ | %O | 127 | DEL | %T, %X, %Y, %Z |