Code 39

Last updated
*WIKIPEDIA* encoded in Code 39 Code 3 of 9.svg
*WIKIPEDIA* encoded in Code 39

Code 39 (also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3) is a variable length, discrete barcode symbology defined in ISO/IEC 16388:2007.

Contents

The Code 39 specification defines 43 characters, consisting of uppercase letters (A through Z), numeric digits (0 through 9) and a number of special characters (-, ., $, /, +, %, and space). An additional character (denoted '*') is used for both start and stop delimiters. Each character is composed of nine elements: five bars and four spaces. Three of the nine elements in each character are wide (binary value 1), and six elements are narrow (binary value 0).

The barcode scheme does not contain a check digit (in contrast to—for instance—Code 128), but it can be considered self-checking 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 used by some postal services (although the Universal Postal Union recommends using Code 128 in all cases [1] ), and can be decoded with virtually any barcode reader. One advantage of Code 39 is that since there is no need to generate a check digit, it can easily be integrated into an existing printing system by adding a barcode font to the system or printer and then printing the raw data in that font.

Code 39 was developed by Dr. David Allais and Ray Stevens of Intermec in 1974. Their original design included two wide bars and one wide space in each character, resulting in 40 possible characters. Setting aside one of these characters as a start and stop pattern left 39 characters, which was the origin of the name Code 39. [2] Four punctuation characters were later added, using no wide bars and three wide spaces, expanding the character set to 43 characters. Code 39 was later standardised as ANSI MH 10.8 M-1983 and MIL-STD-1189. [3] MIL-STD-1189 has been cancelled and replaced by ANSI/AIM BC1/1995, Uniform Symbology Specification — Code 39. [4]

Encoding

The * character presented below is not a true encodable character, but is the start and stop symbol for Code 39. The asymmetry of the symbol allows the reader to determine the direction of the barcode being scanned. This code is traditionally mapped to the * character in barcode fonts and will often appear with the human-readable representation alongside the barcode.

Code 39 characters Free 3 of 9 (Code 39 barcode).svg
Code 39 characters

As a generality, the location of the two wide bars can be considered to encode a number between 1 and 10, and the location of the wide space (which has four possible positions) can be considered to classify the character into one of four groups (from left to right): Letters(+30) (U–Z), Digits(+0) (1–9,0), Letters(+10) (A–J), and Letters(+20) (K–T). For example, the letter P (being the 16th letter of the alphabet) has its bars aligned to represent the number 6, and the space in the far right position to select the group Letters(+20).

When represented as a digit, the number "10" is used to encode the number zero. Because there are only six letters in the Letters(+30) group (letters 30–35, or U–Z), the other four positions in this group (36–39) are used to represent three symbols (dash, period, space) as well as the start/stop character.

The two wide bars, out of five possible positions, encode a number between 1 and 10 using a two-out-of-five code with the following numeric equivalence: 1, 2, 4, 7, 0. The numbers are summed together. For example, the number 6 is encoded NWWNN, with wide bars occupying the positions for 2 and 4 (2+4=6). In the case of NNWWN which is 4+7 = 11 it is assigned to 0 for digits (+0), and 10 for the letter columns (+10 – +30). When encoding the (+10 to +30) letters the equation needs a "−1" added so 'A' is WNNNW → 1 + 10 − 1 → 10 as shown in the table.

The last four characters consist of all narrow bars and three wide spaces. There are four possible positions for the single narrow space.

This table outlines the Code 39 specification. The numeric value assigned to each character (except start/stop) is used in the checksum algorithm described below.

Code 39 characters (and checksum values)
BarsSpaces
|||||+0|||||+10|||||+20|||||+30
|||1|||11|||A10|||K20|||U30
|||2|||22|||B11|||L21|||V31
▮▮|||3▮▮ |||33▮▮|||C12▮▮|||M22▮ ▮|||W32
|||4|||44|||D13|||N23|||X33
|||5|||55|||E14|||O24|||Y34
|▮▮||6|▮ ▮||66|▮▮ ||F15|▮▮||P25| ▮▮||Z35
|||▮▮7|||▮▮77||| ▮▮G16|||▮ ▮Q26|||▮▮-36
|||8|||88|||H17|||R27|||.37
|||9|||99|||I18|||S28||| 38
||▮▮|10|| ▮▮|00||▮ ▮|J19||▮▮ |T29||▮▮|*
||||||||||$39|||||/40|||||+41||||| %42

Characters are separated by an additional narrow space. For example, the full encoding for the single letter "A", which actually includes the start and stop characters as "*A*", is "||▮▮||||||▮▮|". The code will not be read properly without these inter-character spaces. Barcode fonts invariably include this space within the glyph for the character.

Code 39 check digit

Code 39 is sometimes used with an optional modulo 10 or 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 10 or Code 39 mod 43 respectively.

To compute this, each character is assigned a value. The assignments are listed in the table above, and almost, but not quite, systematic.

Here is how to do the checksum calculation:

Full ASCII Code 39

Code 39 is restricted to 43 characters. In Full ASCII Code 39 Symbols 0-9, A-Z, ".", "-" and space are the same as their representations in Code 39. Lower case letters, additional punctuation characters and control characters are represented by sequences of two characters of Code 39.

Code Details
NrCharacterEncoding   NrCharacterEncoding   NrCharacterEncoding   NrCharacterEncoding
0NUL%U   32[space][space]   64@%V   96`%W
1SOH$A   33 !/A   65AA   97a+A
2STX$B   34"/B   66BB   98b+B
3ETX$C   35#/C   67CC   99c+C
4EOT$D   36$/D   68DD   100d+D
5ENQ$E   37%/E   69EE   101e+E
6ACK$F   38&/F   70FF   102f+F
7BEL$G   39'/G   71GG   103g+G
8BS$H   40(/H   72HH   104h+H
9HT$I   41)/I   73II   105i+I
10LF$J   42*/J   74JJ   106j+J
11VT$K   43+/K   75KK   107k+K
12FF$L   44,/L   76LL   108l+L
13CR$M   45--   77MM   109m+M
14SO$N   46..   78NN   110n+N
15SI$O   47//O   79OO   111o+O
16DLE$P   4800   80PP   112p+P
17DC1$Q   4911   81QQ   113q+Q
18DC2$R   5022   82RR   114r+R
19DC3$S   5133   83SS   115s+S
20DC4$T   5244   84TT   116t+T
21NAK$U   5355   85UU   117u+U
22SYN$V   5466   86VV   118v+V
23ETB$W   5577   87WW   119w+W
24CAN$X   5688   88XX   120x+X
25EM$Y   5799   89YY   121y+Y
26SUB$Z   58 :/Z   90ZZ   122z+Z
27ESC%A   59 ;%F   91[%K   123{%P
28FS%B   60<%G   92\%L   124|%Q
29GS%C   61=%H   93]%M   125}%R
30RS%D   62>%I   94^%N   126~%S
31US%E   63 ?%J   95_%O   127DEL%T, %X, %Y, %Z

Software

The following free and open source software can produce Code 39 barcodes:

Related Research Articles

<span class="mw-page-title-main">Universal Product Code</span> Barcode symbology used for tracking trade items in stores

The Universal Product Code is a barcode symbology that is used worldwide for tracking trade items in stores.

POSTNET is a barcode symbology used by the United States Postal Service to assist in directing mail. The ZIP Code or ZIP+4 code is encoded in half- and full-height bars. Most often, the delivery point is added, usually being the last two digits of the address or PO box number.

<span class="mw-page-title-main">PDF417</span> Type of barcode

PDF417 is a stacked linear barcode format used in a variety of applications such as transport, identification cards, and inventory management. "PDF" stands for Portable Data File. The "417" signifies that each pattern in the code consists of 4 bars and spaces in a pattern that is 17 units (modules) long. The PDF417 symbology was invented by Dr. Ynjiun P. Wang at Symbol Technologies in 1991. It is defined in ISO 15438.

<span class="mw-page-title-main">Code 128</span> Barcode format

Code 128 is a high-density linear barcode symbology defined in ISO/IEC 15417:2007. It is used for alphanumeric or numeric-only barcodes. It can encode all 128 characters of ASCII and, by use of an extension symbol (FNC4), the Latin-1 characters defined in ISO/IEC 8859-1. It generally results in more compact barcodes compared to other methods like Code 39, especially when the texts contain mostly digits. Code 128 was developed by the Computer Identics Corporation in 1981.

<span class="mw-page-title-main">Code 93</span>

Code 93 is a barcode symbology designed in 1982 by Intermec to provide a higher density and data security enhancement to Code 39. It is an alphanumeric, variable length symbology. Code 93 is used primarily by Canada Post to encode supplementary delivery information. Every symbol includes two check characters.

<span class="mw-page-title-main">Interleaved 2 of 5</span> Type of barcode

Interleaved 2 of 5 (ITF) is a continuous two-width barcode symbology encoding digits. It is used commercially on 135 film, for ITF-14 barcodes, and on cartons of some products, while the products inside are labeled with UPC or EAN.

<span class="mw-page-title-main">PostBar</span>

PostBar, also known as CPC 4-State, is the black-ink barcode system used by Canada Post in its automated mail sorting and delivery operations. It is similar to other 4 State barcode systems used by Australia Post and the United Kingdom's Royal Mail, but uses an obscured structure and encoding system unique to Canada Post. This particular bar code system is used on "flats" and parcels.

Telepen is the name of a barcode symbology designed to encode all 128 ASCII characters without using shift characters for code switching, and only using two different widths for both bars and spaces.. The symbology was devised by George Sims of SB Electronic Systems Ltd. Telepen was originally designed in the UK in 1972.

<span class="mw-page-title-main">International Article Number</span> Standard barcode system used in global trade

The International Article Number is a standard describing a barcode symbology and numbering system used in global trade to identify a specific retail product type, in a specific packaging configuration, from a specific manufacturer. The standard has been subsumed in the Global Trade Item Number standard from the GS1 organization; the same numbers can be referred to as GTINs and can be encoded in other barcode symbologies defined by GS1. EAN barcodes are used worldwide for lookup at retail point of sale, but can also be used as numbers for other purposes such as wholesale ordering or accounting. These barcodes only represent the digits 0–9, unlike some other barcode symbologies which can represent additional characters.

Codabar is a linear barcode symbology developed in 1972 by Pitney Bowes Corp. It and its variants are also known as Codeabar, Ames Code, NW-7, Monarch, Code 2 of 7, Rationalized Codabar, ANSI/AIM BC3-1995 or USD-4. Although Codabar has not been registered for US federal trademark status, its hyphenated variant Code-a-bar is a registered trademark.

<span class="mw-page-title-main">MSI Barcode</span> Barcode symbology

MSI is a barcode symbology developed by the MSI Data Corporation, based on the original Plessey Code symbology. It is a continuous symbology that is not self-checking. MSI is used primarily for inventory control, marking storage containers and shelves in warehouse environments.

<span class="mw-page-title-main">RM4SCC</span> Barcode system used by Royal Mail

RM4SCC is the name of the barcode character set based on the Royal Mail 4-State Bar Code symbology created by Royal Mail. The RM4SCC is used for the Royal Mail Cleanmail service. It enables UK postcodes as well as Delivery Point Suffixes (DPSs) to be easily read by a machine at high speed.

<span class="mw-page-title-main">Intelligent Mail barcode</span> Barcode for use on U.S. mail

The Intelligent Mail Barcode (IMb) is a 65-bar barcode for use on mail in the United States. The term "Intelligent Mail" refers to services offered by the United States Postal Service for domestic mail delivery. The IM barcode is intended to provide greater information and functionality than its predecessors POSTNET and PLANET. An Intelligent Mail barcode has also been referred to as a One Code Solution and a 4-State Customer Barcode, abbreviated 4CB, 4-CB or USPS4CB. The complete specification can be found in USPS Document USPS-B-3200. It effectively incorporates the routing ZIP Code and tracking information included in previously used postal barcode standards.

<span class="mw-page-title-main">Code 11</span> Barcode symbology

Code 11 is a barcode symbology developed by Intermec in 1977, and it is used primarily in telecommunications. The symbol can encode any length string consisting of the digits 0–9 and the dash character (-). A twelfth code represents the start/stop character, commonly printed as "*". One or two modulo-11 check digit(s) can be included.

Plessey Code is a 1D linear barcode symbology based on pulse-width modulation, developed in 1971 by The Plessey Company plc, a British-based company. It is one of the first barcode symbology, and is still used rarely in some libraries and for shelf tags in retail stores, in part as a solution to their internal requirement for stock control. The system was first used in the early 1970s by J.Sainsbury to identify all of its products on supermarket shelves for its product restocking system.

<span class="mw-page-title-main">ITF-6</span>

ITF-6 is the implementation of an Interleaved 2 of 5 (ITF) barcode to encode a addon to ITF-14 and ITF-16 barcodes. Originally was developed as a part of JIS specification for Physical Distribution Center. Instead of ITF-14, it wasn’t standardized by ISO Committee but it is widely used to encode additional data to Global Trade Item Number such as items quantity or container weight.

Barcode library or Barcode SDK is a software library that can be used to add barcode features to desktop, web, mobile or embedded applications. Barcode library presents sets of subroutines or objects which allow to create barcode images and put them on surfaces or recognize machine-encoded text / data from scanned or captured by camera images with embedded barcodes. The library can support two modes: generation and recognition mode, some libraries support barcode reading and writing in the same way, but some libraries support only one mode.

<span class="mw-page-title-main">Industrial 2 of 5</span>

Industrial 2 of 5. is a variable length, discrete, two width symbology. Industrial 2 of 5 is a subset of two-out-of-five codes.

<span class="mw-page-title-main">Codablock</span>

Codablock is a family of stacked 1D barcodes which was invented in Identcode Systeme GmbH in Germany in 1989 by Heinrich Oehlmann. Codablock barcodes are based on stacked Code 39 and Code 128 symbologies and have some advantages of 2D barcodes.

<span class="mw-page-title-main">Matrix 2 of 5</span>

Matrix 2 of 5 is a variable length, discrete, two width symbology. Matrix 2 of 5 is a subset of two-out-of-five codes. Unlike Industrial 2 of 5 code, Matrix 2 of 5 can encode data not only with black bars but with white spaces.

References

  1. As one example of an international standard, see "Identification of postal items 13-character identifier" (PDF). Universal Postal Union. 17 October 2017.
  2. Allais, D. C. (2006). "AIDC Memoirs" (PDF). Archived from the original (PDF) on 2013-01-26. Retrieved 2010-06-02.{{cite journal}}: Cite journal requires |journal= (help)
  3. "MIL-STD-1189 Standard Department of Defense Barcode Symbology". 1989-08-10. Archived from the original on 2011-07-22. Retrieved 2010-07-22.
  4. "Adoption Notice: AIM/BC1 Uniform Symbology Specification". 1997-06-19. Archived from the original on 2011-09-27. Retrieved 2011-04-06.
  5. "GNU Barcode". GNU Project. 19 February 2020.