www.terrapin.co.uk
company <
testimonials <
products & services <
supported printers <
contact us <
Products and Services
 
fonts overview
font services
bar codes
bar code labels
conversions & formatting
forms
graphics
ecofont
elixir design pro tools
euro services
 
linear bar codes
windows linear barcoding utilities
2D barcoding
linear vs. 2D barcoding
postal barcodes
other machine readable fonts
 
Code 2 of 5 Interleaved
Code 128
Code 3 of 9
EAN/UPC
 

Barcode specifications

Code 128

Solutions available: Windows stand-alone font, Windows font + encoder, AFP, Xerox, PCL, and bespoke solutions.

Click here for Barcode Singles product brochure (font-based solution).
Click here to download Barcode Singles demo software.

Click here to download WBC4 demo software (image-based solution).

Or, alternatively, email sales@terrapin.co.uk with your requirements and we will find a solution for you.

Code 128 specification
Data Type: All 128 ASCII characters, and 100 digit pairs
Bar Code Length: Variable
Checksum: Modulo 103
Wide/Narrow bar width ratio: 1:2:3:4

General Information
Code 128 is a very high density alphanumeric barcode that can encode all 128 ASCII characters and four additional characters for non data-oriented functions. Numeric-only data can be represented in double density mode, i.e. 2 digits per character.

The Code 128 character set is composed of:

  • 128 ASCII characters
  • 4 special characters
  • 4 control characters
  • 3 start characters
  • 1 stop character

    The six elements which make up a single barcode character each consist of three blanks and three spaces (except for the stop character which is built up of four bars and three spaces). The ratio between the four element widths (bars or spaces) is 1:2, 1:3 and 1:4. Each Code 128 character consists of 11 modules, where a module is the narrowest element width. So if the narrowest element width is '1' then the widths of the other elements are 2, 3 and 4, and the overall width of a character (in pixels) is 11. If the narrowest module is '2' then the widths of the other elements are 4, 6, and 8 and the overall width of the character (in pixels) is 22, and so on.

    Three character sets (A, B and C) are needed to enable all 128 ASCII characters and the double density digits to be printed. It is important to note that the font itself does not contain three different sets of characters - the font only contains one set of characters. The change between character sets occurs in the barcode reader by selecting different Start characters or Shift characters within the font, and this causes the barcode reader to switch between character sets.

    In double-density mode (Character Set C), each Code 128 character represents a pair of digits. For instance, the two digits '1' and '2' in Code 128 C become a single character '12'. Therefore, you should have an even number of digits in your numeric fields.

    Special control characters can be used within the barcode symbol to switch from one character set to another. This enables users to employ all the ASCII characters (character set A or B), and also to utilise the double-density representation by Character Set C.

    Each barcode symbol operates with two self-check facilities which function independently of one another. One self-check function works by comparing the number of modules in the bars and spaces to ensure that they agree; the second using a check digit calculated using Modulo 103.

    Character Sets A, B and C
    Character Set A includes all of the standard upper case alphanumeric keyboard characters, plus ASCII control characters and special characters.

    Character Set B also contains all the standard upper case and lower case alphanumeric keyboard characters and special characters.

    Character Set C is composed of 100 pairs of digits from 00 to 99, and special characters. This enables numeric-only data to be represented with twice the density.

    Special Characters
    The last seven characters in Character Sets A and B, and the last three characters in Set C are non-data oriented characters, and are used to define special processes for the barcode reader. The reader does not display or transfer these characters.

    It is possible to switch from one character set to another within a barcode symbol. This switch is initiated using special code characters and shift characters. The code characters enable users to initiate a switch in character sets, which then applies to all subsequent characters in the barcode symbol. When the Shift character is used, the change only applies to the next character. Function characters (FNCs) define commands which are transferred to the barcode reader, instructing the device to execute special actions or applications.

    Code Characters
    The code characters for Character Sets A, B or C initiate a switch from the character set previously defined to the character set defined by the code character. For example while in Character Set A, sending the code character 'Code B' will switch the reader into Character Set B mode. The reader will then remain in Set B mode until the end of the symbol or until the next code character.

    Shift Characters
    The Shift character is used to switch from Character Set A to B, or from B to A temporarily; the change applies to the character following the Shift character. All subsequent characters are then given in the original Character Set (A or B) depending on which was defined before the Shift.

    Function Characters
    FNC1 to FNC4 are function characters and define commands which are transferred to the barcode reader, giving instructions to execute special actions or applications.

    EAN-128
    UCC/EAN-128 Symbology is a unique version of Code 128, whereby the insertion of the FNC1 character following the start character identifies the symbol as UCC/EAN-128. It is identical to Code 128 in every other respect. UCC/EAN Code 128 is the barcode recommended for use by the US Postal Service (USPS) special services, which has a height of .75" and an X dimension of .013".

    GS1-128
    GS1-128 is the same as EAN-128 and UCC-128.

    Value
    Each Code 128 character has a value (as listed in the character arrangement table). This value is used to calculate the check digit.

    The complete barcode symbol consists of a quiet zone, a start character, the data string, a check digit, the stop character and a trailing quiet zone. The check digit is calculated using Modulo 103.

    Encoding the Symbol
    (This is an example using Code 128 C with a PC character encoding)

    Example data 1234567890

    Because our example string is numbers only, we can take advantage of Code 128's double-density feature by using Character Set C - pairs of digits.

    The 10 individual numbers in the example must be turned into pairs of digits. Each digit pair must then be translated to its correct position in the barcode font using the character arrangement table.

    Pair of digits Start C 12 34 56 78 90 85
    (check digit)
    Stop
    ASCII decimal position in font 171 44 66 88 110 122 117 172
    Keystroke « , B X n z u ¬

    The final string should look like this:

    Multi-platform considerations
    Character coding rules vary across viewing and printing platforms, so the fonts supplied by Terrapin come with different encoding tables (Character Arrangement Tables) depending on their use. If the font is being used on a PC then you'll get a standard Windows encoding. If it's being used on a Mainframe, you'll get an EBCDIC encoding. But if you're using the font on BOTH platforms, then we need to tailor the font so you can print and view all characters correctly on all platforms. If you're not sure which Character Arrangement Table to use, please consult with us.

    Modulo 103 Check Digit
    A check digit can be used to mathematically verify that the barcode data is correct. In Code 128 the check digit is computed using Modulo 103 and positioned immediately before the STOP character.

    The check digit is calculated using the VALUE defined for every Code 128 character (see Character Arrangement Table). This is done by summing the Start Code value plus the product of each character position (most significant character position equals 1) and the character value of the character in that position. The sum of all these is divided by 103. The remainder of the answer is the value of the Check Digit (which can be looked up from the table). Every encoded character is included except the Stop and Check Digit.

    Start C
    12
    34
    56
    78
    90
    Stop
    Value
    105
    12
    34
    56
    78
    90
    -
    Weighting
    -
    1
    2
    3
    4
    5
    105 + (12 x 1) + (34 x 2) + (56 x 3) + (78 x 4) + (90 x 5) =1115
    1115 ÷ 103 = 10 Remainder 85

    Character Arrangement Tables

  • IBM AFP Format (EBCDIC) (also used for DOC1)
  • Xerox Format (ASCII)
  • Windows Format - We have removed the link to our Windows Tables because there is no longer one standard table that we use for our Code 128 Windows fonts. Over the years we have had to produce many different versions of the table, depending on which platforms and applications the fonts were for. If you need to reference a Windows table, please email info@terrapin.co.uk and tell us which Terrapin-supplied font you are using, and we will supply the table.

  •