Code 128 Barcode FAQ

What is Code 128 barcode, full ascii character set, char length, check digit, barcode label, bar module size, reading Code 128 barcode











Code 128 Barcode Introduction

What is Code 128 barcode?

Code 128 barcode is a high-density linear barcode symbology, which encodes digits, text, control characters, and full ASCII 128 characters.

Code 128, also known as ANSI/AIM 128, ANSI/AIM Code 128, USS Code 128, Uniform Symbology Specification Code 128, is a very capable linear barcode of excellent density, high reliability.

What are Code 128 standards?

Code 128 barcode specification is defined in ISO/IEC 15417 Second edition in 2007-06-01. The specification full name is "ISO/IEC 15417:2007 Information technology - Automatic identification and data capture techniques - Code 128 bar code symbology specification".

There are several standards based on Code 128 specification.

  • GS1-128
  • ISBT 128
  • ISBT 128 Concatenated
  • USS Code 128
  • ISS Code 128: International Symbology Specification (ISS) Code 128 is defined in AIM BC4:1999 International Symbology Specification
  • SSCC-18: is an 18-digit number used to identify logistics units

What is Code 128 barcode used for?

Code 128 barcode is a common linear barcode type used in:

  • Food and non-food industries
  • Shipping and packing industry
  • Health sector
  • Public sector and government bodies


Code 128 Barcode Symbol Structure

Code 128 barcode symbols shall comprise

  1. a leading quiet zone
  2. a Start character
  3. one or more data characters
  4. a Code 128 check digit
  5. a Stop character
  6. a trailing quiet zone



Code 128 Barcode Encoding Character Set

Code 128 valid data character set

Code 128 barcode supports the following data characters

  • All 128 Full ASCII characters defined in ISO/IEC 646
  • Extended ASCII characters are also supported with Function Character (FNC4) used. (By default are values 128 - 255 of ISO/IEC 8859-1, Latin Alphabet 1)
  • 4 non-data function characters
  • 4 code set selection characters
  • 3 Start characters
  • 1 Stop character

Code 128 Data Three Code Sets

Code 128 barcode has three unique data character code sets shown in table below

  • Code Sets A
  • Code Sets B
  • Code Sets C

Each code set includes a subset of the full ASCII character set together with various auxiliary characters.

Code Set A
Code Set A includes all of the standard upper case alphanumeric characters and punctuation characters together with the control characters.

Code Set B
Code Set B includes all of the standard upper case alphanumeric characters and punctuation characters together with the lower case alphabetic characters and seven special characters.

Code Set C
Code Set C includes the set of 100 digit pairs from 00 to 99 inclusive, as well as three special characters. This allows numeric data to be encoded as two data digits per symbol character.



What is the length of Code 128 barcode?

The Code 128 specification does not specify the maximum number of characters in a single barcode image.

However some Code 128 standards will provide the limits. GS1-128 has limits the maximum length of Code 128 data to 48 characters.



Code 128 start/stop characters

Code 128 has 3 start chars and 1 stop char. Start characters A, B and C define the corresponding code set to be used initially in the symbol.

The Stop character has unique 13 bar modules. The all three start chars, Code 128 symbol chars and check digit have 11 bar modules.

Start and Stop characters will not be displayed in the Code 128 printed barcode text.



Code 128 special characters

Code 128 barcode supports the following special characters.

  • Code Set and shift characters: Code A, B, or C and Shift characters shall be used to change from one code set to another.

  • Function characters: define instructions to the bar code reading device to allow for special operations and applications. FNC4 will enable full ASCII data encoding in Code 128.

  • Start and stop characters: 3 start chars A, B and C define the corresponding code set to be used initially in the symbol.


Code 128 barcode function characters

Code 128 Function Characters (FNC) define instructions to the bar code reading device to allow for special operations and applications.

  • FNC1: It is reserved use for GS1 (EAN.UCC) system
  • FNC2: It is for message append.
  • FNC3: It instructs the bar code reader to interpret the data from the symbol containing the FNC3 character as instructions for initialization or reprogramming of the bar code reader.
  • FNC4: It is used to represent an extended character set (byte values 128 to 255 in ISO/IEC 8859-1 by default)



Table 1 - Code 128 character encodation

Symbol Char Value Code Set A ISO/IEC 646 Value for Set A Code Set B ISO/IEC 646 Value for Set B Code Set C
0 space 32 space 32 00
1 ! 33 ! 33 01
2 " 34 " 34 02
3 # 35 # 35 03
4 $ 36 $ 36 04
5 % 37 % 37 05
6 & 38 & 38 06
7 apostrophe 39 apostrophe 39 07
8 ( 40 ( 40 08
9 ) 41 ) 41 09
10 * 42 * 42 10
11 + 43 + 43 11
12 comma 44 comma 44 12
13 - 45 - 45 13
14 full stop 46 full stop 46 14
15 / 47 / 47 15
16 0 48 0 48 16
17 1 49 1 49 17
18 2 50 2 50 18
19 3 51 3 51 19
20 4 52 4 52 20
21 5 53 5 53 21
22 6 54 6 54 22
23 7 55 7 55 23
24 8 56 8 56 24
25 9 57 9 57 25
26 colon 58 colon 58 26
27 semi-colon 59 semi-colon 59 27
28 < 60 < 60 28
29 = 61 = 61 29
30 > 62 > 62 30
31 ? 63 ? 63 31
32 @ 64 @ 64 32
33 A 65 A 65 33
34 B 66 B 66 34
35 C 67 C 67 35
36 D 68 D 68 36
37 E 69 E 69 37
38 F 70 F 70 38
39 G 71 G 71 39
40 H 72 H 72 40
41 I 73 I 73 41
42 J 74 J 74 42
43 K 75 K 75 43
44 L 76 L 76 44
45 M 77 M 77 45
46 N 78 N 78 46
47 O 79 O 79 47
48 P 80 P 80 48
49 Q 81 Q 81 49
50 R 82 R 82 50
51 S 83 S 83 51
52 T 84 T 84 52
53 U 85 U 85 53
54 V 86 V 86 54
55 W 87 W 87 55
56 X 88 X 88 56
57 Y 89 Y 89 57
58 Z 90 Z 90 58
59 [ 91 [ 91 59
60 \ 92 \ 92 60
61 ] 93 ] 93 61
62 ^ 94 ^ 94 62
63 _ 95 _ 95 63
64 NUL 00 grave accent 96 64
65 SOH 01 a 97 65
66 STX 02 b 98 66
67 ETX 03 c 99 67
68 EOT 04 d 100 68
69 ENQ 05 e 101 69
70 ACK 06 f 102 70
71 BEL 07 g 103 71
72 BS 08 h 104 72
73 HT 09 i 105 73
74 LF 10 j 106 74
75 VT 11 k 107 75
76 FF 12 l 108 76
77 CR 13 m 109 77
78 SO 14 n 110 78
79 SI 15 o 111 79
80 DLE 16 p 112 80
81 DC1 17 q 113 81
82 DC2 18 r 114 82
83 DC3 19 s 115 83
84 DC4 20 t 116 84
85 NAK 21 u 117 85
86 SYN 22 v 118 86
87 ETB 23 w 119 87
88 CAN 24 x 120 88
89 EM 25 y 121 89
90 SUB 26 z 122 90
91 ESC 27 { 123 91
92 FS 28 | 124 92
93 GS 29 } 125 93
94 RS 30 ~ 126 94
95 US 31 DEL 127 95
96 FNC3 FNC3 96
97 FNC2 FNC2 97
98 SHIFT SHIFT 98
99 CODE C CODE C 99
100 CODE B FNC4 CODE B
101 FNC4 CODE A CODE A
102 FNC1 FNC1 FNC1
103 Start A
104 Start B
105 Start C



Code 128 Symbol Check Digit Character

Code 128 barcode contains a mandatory check digit (checksum) character, which is based on module 103 (mod 103).

The Code 128 check digit will not be displayed in the human readable interpretation (barcode text), and it will not be returned by the barcode decoder also.

Code 128 barcode check digit calculator

The Code 128 barcode check digit (checksum) character shall be calculated according to the following algorithm.

  1. Retrieve each data character value from character data table above
  2. Each symbol character position is given a weighting. The Start character position is weighted 1. Then, beginning on the left with the first symbol character following the Start character, the weights are 1, 2 ,3, 4, ... , n, for all following symbol character positions up to, but not including, that of the symbol check character itself; n denotes the number of symbol characters representing data or special information in the symbol, exclusive of the Start/Stop characters and symbol check character.
  3. Multiply each symbol character value by its weighting.
  4. Sum the products of the calculation in the previous step
  5. Divide this sum by 103.
  6. The remainder derived from the calculation in the previous step is the symbol character value of the symbol check character.

For example, calculate the check character for Code 128 data "AIM1234"

Characters Start Code B A I M Code C 12 34
Char Values 104 33 41 45 99 12 34
Weights 1 1 2 3 4 5 6
Products 104 33 82 135 396 60 204
Sum of Products 1014
Divide by 103 (mod 103) 1014 / 103 = 9
Remainder 87 (check digit character value)



Code 128 Human Readable Interpretation (HRI)

Code 128 text printed below barcode is also named Code 128 human-readable interpretation (HRI).

According to the Code 128 barcode specification,

  • HRI should be printed with the Code 128 symbol barcode.
  • Start/stop and special characters shall not be printed.
  • Checksum digit should not be printed also.
  • Text size and font style are not specified.
  • Text can be printed anywhere in the area surrounding the barcode, as long as quiet zone boundaries are not violated.

             



Code 128 Barcode Symbol Character

When a barcode generator software encodes Code 128 data characters, it will convert data characters to Code 128 symbol characters first.

  • Each symbol character comprises six elements (three bars and three spaces arranged alternately from left to right, commencing with a bar).
  • Each of element is 1, 2, 3 or 4 modules wide, with a total width of 11 modules.
  • The sum of the bar modules in any symbol character is always even (even parity) and that of the space modules is therefore always odd.
  • This parity feature enables character self-checking to be carried out.





The image below illustrates the encodation of the symbol character value 35, which represents data character 'C' in Code Set A or B or the two digits '35' in Code Set C.



The Stop character comprises an additional bar element two modules wide making its total width 13 modules.



Code 128 Barcode Dimension Size

Code 128 barcode uses the following dimension settings:

  • Width of narrow element (X): the mimumum bar width is defined by the application specification
  • Quiet zone: the minimum width of quiet zone is 10X.

Code 128 barcode size calculator

The width of a Code 128 barcode symbol, including quiet zones, can be calculated from the following expression:

W = [ 11 (C+ 2) + 2 ] X + 2Q

where

  • W: is the barcode width
  • C: is the number of Code 128 symbol characters (including the check digit character)
  • X: is the width of a narrow element
  • Q: is the width of the quiet zone

Note: It is necessary to apply rules to determine the number of characters before the above expression can be evaluated.












Code 128 Software and Developer Components

















Terms of Use | Privacy Policy
Copyright © OnBarcode.com . All rights reserved.