Message Forum




Barcode Printers


Contact Us

Legal Info

Privacy Policy


See Also:    Interleaved 2 of 5    Symbology Index

Quick Links: Background    Encoding    Structure    Example    Industrial 2 of 5


Stanadard 2 of 5 is a low-density numeric symbology that has been with us since the 1960s. It has been used in the photofinishing and warehouse sorting industries, as well as sequentially numbering airline tickets. The symbology is called "2 of 5" due to the fact that digits are encoded with 5 bars, 2 of which are always wide (and the remaining three are narrow).

Standard 2 of 5 is a very simple symbology in that all encoding information is encoded in the width of the bars. The spaces in the barcode exist only to separate the bars themselves. Additionally, a bar may either be wide or narrow, a wide bar generally being 3 times as wide as a narrow bar. The exact size of the spaces is not critical, but is generally the same width as a narrow bar.

A typical Standard 2 of 5 barcode is:

    NOTE: A more efficient implement of Standard 2 of 5 is the newer Interleaved 2 of 5. The encoding method is essentially the same except that Interleaved 2 of 5 allows information to be encoded in both the bars and spaces, whereas Standard 2 of 5 only encodes information in the width of the bars. Thus, Interleaved 2 of 5 is a slightly higher-density symbology. The main advantages of Standard 2 of 5 are its simplicity and the fact that it can encode any number of numeric values, whereas Interleaved 2 of 5 must always encode an even number of numeric values.


Standard 2 of 5 may include an optional modulo 10 check digit. This is not required as part of the 2 of 5 specification, but rather may be implemented in a user program to improve the accuracy of the symbology. As such, a programmer may actaully use any check digit scheme that he or she desires. However, the checksum implemented in 2 of 5 is often the following.

The steps for calculating the check digit are as follows:

  1. Consider the right-most digit of the message to be in an "even" position, and assign odd/even to each character moving from right to left.
  2. Sum the digits in all odd positions.
  3. Sum the digits in all even positions, and multiply the result by 3.
  4. Sum the totals calculated in steps 2 and 3.
  5. The check digit is the number which, when added to the totals calculated in step 4, result in a number evenly divisible by 10.
  6. If the sum calculated in step 4 is evenly disivisible by 10, the check digit is "0" (not 10).
This is easier to understand with an example. Let's calculate the checksum digit for the above barcode, 12345670. Actually, we know the checksum digit is the last digit in the barcode, "0". This means the "message" itself of the barcode is really 1234567 (we just dropped the last character of the barcode). Thus, we must calculate a check digit for the string 1234567.
    Barcode 1 2 3 4 5 6 7
    Position E O E O E O E
    Weighting 3 1 3 1 3 1 3
    Calculation 1 * 3 2 * 1 3 * 3 4 * 1 5 * 3 6 * 1 7 * 3
    Weighted Sum 3 2 9 4 15 6 21

Summing up the weighted sum for each digit, we get 3 + 2 + 9 + 4 + 15 + 6 + 21 = 60. This is the checksum value. However, there is only one checksum digit. The checksum digit is the value which must be added to the checksum value in order to make it even divisible by 10. In this case, 60 is already divisible by 10 so we need not add anything-thus chec checksum digit is "0". We subsequently append the original barcode message (1234567) with our newly calculated check digit (0), to arrive at the final value of 12345670.


In the following text, we will discuss the encoding of the barcode by considering that the number "1" represents a "dark" or "bar" section of the barcode whereas a "0" represents a "light" or "space" section of the barcode. Thus the numbers 1101 represents a double-wide bar (11), followed by a single-wide space (0), followed by a single-wide bar (1). This would be printed in the barcode as:


A Standard 2 of 5 barcode has the following physical structure:

  1. Start character, encoded as 11011010.
  2. Data characters properly encoded (see encoding table below).
  3. Stop character, encoded as 11010110.


This table indicates how to encode each digit of a Standard 2 of 5 barcode. Note that the encoding is expressed as "N" (narrow bar) or "W" (wide bar). Normally a wide bar is three times as wide as a narrow bar. Thus "N" is equivalent to "1" whereas "W" is equivalent to "111". Each bar is separated by a narrow space ("0").

    0 NNWWN
    1 WNNNW
    2 NWNNW
    3 WWNNN
    4 NNWNW
    5 WNWNN
    6 NWWNN
    7 NNNWW
    8 WNNWN
    9 NWNWN


We will now code the above example in Standard 2 of 5: "12345670". By this point we would already have calculated the checksum digit as "0" (the last digit of the barcode value) as illustrated in the checksum calculation section illustrated above.

Now we need to encode each digit using the encoding table above.

  1. The START character: 11011010.
  2. The digit "1" encoded as bars: WNNNW: 11101010101110.
  3. The digit "2" encoded in spaces: NWNNW: 10111010101110.
  4. The digit "3" encoded in bars: WWNNN: 11101110101010.
  5. The digit "4" encoded in spaces: NNWNW: 10101110101110.
  6. The digit "5" encoded in bars: WNWNN: 11101011101010.
  7. The digit "6" encoded in spaces: NWWNN: 10111011101010.
  8. The digit "7" encoded in bars: NNNWW: 10101011101110.
  9. The digit "0" encoded in spaces: NNWWN: 10101110111010.
  10. The STOP character: 1101011.
This is shown in the following graphical representation where the barcode has been sectioned-off into areas that reflect each of the 10 components just mentioned.

    NOTE: Interleaved 2 of 5 is a higher-density version of 2 of 5. While it is reasonable to support Standard 2 of 5 for legacy systems, new projects should seriously consider using Interleaved 2 of 5 rather than Standard 2 of 5.


"Industrial 2 of 5" is another name of "Standard 2 of 5", and is functionally identical to the Standard 2 of 5 explaiend on this page.
© Copyright 2006, Inc. All Rights Reserved.
Information provided "as-is" without warranty. Please
see details.
Contact us for usage and copy permission.