Code 128

Code 128 is an increased density 1D barcode that can encode all standard (ASCII) characters, both letters and numbers. It also provides an extension character (FNC4) to encode some national symbols. The checksum digit helps to detect errors also when the individual symbols in the message appear to be correct.

This applet converts user input into Code 128. If your input cannot be represented in Code 128, the applet shows red crossing lines.

The Code 128 label can be as long as necessary to store the encoded data[1], while its actual length should be limited by the scanner capabilities. It can be scanned both right to left and left to right[2]. Human readable information, if any, must not overlap with the barcode area.


A Code 128 barcode will have six sections:

  • Quiet zone
  • Start character
  • Encoded data
  • Check character
  • Stop character
  • Quiet zone

The quiet zone is at least ten times the width of the narrowest bar/space element.The check character is a weighted sum (modulo 103) of all the characters.

Code sets

Code 128 includes 103 data symbols, 3 start codes, and 1 stop code. To represent all 128 ASCII values, there are three code sets ( A, B, C) that can be mixed within a single barcode. The codes 103, 104, 105 are used to switch between these code sets:

  • 128A contains ASCII characters 00 to 95 (0-9, A-Z and control codes), special characters, and FNC 1-4
  • 128B contains ASCII characters 32 to 127 (0-9, A-Z, a-z), special characters, and FNC 1-4
  • 128C is a high density set to encode numbers. It encodes two digits with one code (00-99) and FNC1

Details of encoding

Each character in the barcode symbol contains three bars and three spaces and is terminated by the additional extra bar of length 2 (the stop mark). Each bar or space is 1, 2, 3 or 4 units wide. The sum of the widths of bars must be even and the sum of the widths of the spaces must be odd. Each data character is made of 11 black or white modules, except the stop character that is made of 13 modules[3].

Code 128 specifies a combination of 6 bars and spaces for each character. Each character begins with a bar and ends with a space. The exception of these two rules is the Stop chracter that uses 7 bars and spaces and ends in a bar. The width of each bar or space can be 1, 2, 3 or 4 units.


This web page reuses material from Wikipedia page under the rights of CC-BY-SA license. As a result, the content of this page is and will stay available under the rights of this license regardless of restrictions that apply to other pages of this website.


  1. 1
  2. 2
  3. 3 Barcode Island

See also