The Code 128 barcode symbology is used to create GS1-128 (formerly UCC128 or EAN128) barcodes such as the GS1-128 symbols and data structure for SSCC18 and SCC14. Every GS1-128 barcode begins with a Start C character followed by a (FNC1) “Function Code One” and an Application Identifier (AI) number. The AI defines a specific purpose for the data field after it. The combination of a the AI and its data field is referred to as the element string.
- GS1-128 Symbol Size
- Encoding FNC1 and AIs
- Encoding FNC2
- MOD 10 Check Digits
- Examples of encoding GS1-128
- GS1 Unique Device Identification (UDI)
- Decoding AIs and FNC1 Codes
Below are some of the requirements for GS1-128 and how to implement them in IDAutomation products.
According to GS1-128 specifications, the height of the barcode should be 15% of the length or 0.50 inch (1.3 CM), whichever is greater.
- Within most GS1 applications, the X dimension may range from 10 mils (.025 cm) to 40 mils (.1 cm). When the X dimension used is between 10 and 16 mils, the symbol should be 0.50″ tall. When the X dimension used is between 16 and 40 mils, the symbol should be 1.25″ tall. The X dimension of 10 mils (0.10″) is recommended for use with most hand-held scanners.
- The IDAutomation Code 128 Barcode Font IDAutomationC128M and Universal Barcode Font IDAutomation Uni M are specifically designed to match the GS1 size of 0.50″ tall and an X dimension of 10 mils when printed at 12 points.
- The GS1-128 Barcode Font Suite is a collection of GS1 fonts designed to match any GS1 specification including several sizes that are 0.50″ (13mm) to 1.25″ (32mm) in height at various required X dimensions.
Every GS1-128 barcode begins with the (FNC1) “Function Code One” character and an Application Identifier (AI) number. The AI defines a specific purpose for the data field after it. The combination of the AI and its data field is referred to as the element string. The AI is represented with parentheses around it in the Human Readable representation below the barcode. Multiple element strings may also be encoded according to GS-1 specifications. Variable element strings should be encoded last in the symbol and FNC1 characters must be encoded between two or more variable length element strings.
FNC1 Encoding using ASCII 202
Several IDAutomation products support the inclusion of the AI with ASCII 202 (the Ê character) in Code 128 auto mode. When using this method, ApplyTilde does not have to be enabled. For systems outside of the USA or when using a Mac, IDAutomation recommends use the ApplyTilde or the process tilde option to encode ASCII 202 as ~202. Optionally, the FNC1 may also be encoded when parentheses are included around the first AI in the data.
|FNC1 Encoding Options||Notes|
|Ê0112345678901231||ApplyTilde does not have to be enabled. Not recommended for systems outside of the USA or when using a Mac.|
|~2020112345678901231||ApplyTilde must be enabled. The three characters after the tilde are encoded directly within the barcode as a single ASCII character.|
|(01)12345678901231||ApplyTilde must be enabled and the parentheses must appear around the AI.|
Products updated July 2016 or later include additional text formatting that will automatically add the parentheses around AIs after fixed length element strings without the need to add additional FNC1 codes. For example, Ê011234567890123115991231 or ~202011234567890123115991231 will appears as:
In earlier products, to make the human-readable digits accurate, use the associated ASCII character listed below as the FNC1 for the correct number of digits in the AI. For example: ~2120112345678901231~21215991231.
ASCII212: Ô = 2 digits ASCII213: Õ = 3 digits ASCII214: Ö = 4 digits
ASCII215: × = 5 digits ASCII216: Ø = 6 digits ASCII217: Ù = 7 digits
The method also inserts FNC1 codes into the symbol. If symbol size needs to be minimized, multiple AIs may be included in a single barcode without encoding additional FNC1 codes, provided that variable length AIs are included last. The parentheses may not correctly appear in the text interpretation of the symbol when using this method of encoding, however they may be easily included by inserting a custom text field below the symbol if required.
Some characters used above such as Ô and Õ are from the 1250 ISO Latin 1 character set used in Europe & the USA. When using the Mac or systems outside of the USA, the appropriate character must be used that represents the proper ASCII location. When in doubt, use the Tilde Method. For example, instead of using Ê use ~202.
The FNC2 character may be inserted as ASCII 197 (the Å character) in IDAutomation barcode products, for example: ~19780-128-4991 encodes [FNC2]80-128-4991. The IDAutomation SC5USB Barcode Scanner may be programmed to hold a barcode starting with FNC2 in memory and only transmit data after scanning a second barcode, which allows a continuous text string to be encoded in two barcodes.
A GS1 MOD 10 check digit is often required when implementing GS1-128 barcodes for various specifications; the AI is usually not included in the MOD 10 calculation. If a MOD 10 check digit is needed, it may be either pre-calculated, or calculated in the component at the time the barcode is generated.
- To enable IDAutomation barcode products to calculate the MOD 10 when the barcode is created, the ApplyTilde property must be enabled and the format ~m?? must be used where ?? is a 2 digit number representing the number of characters preceding the tilde on which to base the Mod 10 calculation.
- For example, entering the data of ~2120000801234999999999~m17 generates a barcode encoding the FNC1 character followed by an AI of (00) and the number of 008012349999999997.
- This MOD 10 calculation may be checked online with the IDAutomation Online Barcode Font Encoder by entering the number of 00801234999999999 in the “Data To Encode” field and choosing the “MOD 10” option. GS1 also offers an online check digit calculator with manual calculation examples.
For testing purposes, GS1-128 symbols may be generated with the Free Online Barcode Creator or from the bcgen.com command line, for example: https://www.bcgen.com/demo/linear-dbgs.aspx?D=(01)10614141543219&PT=T
A few examples are included below:
|Text string sent to DataToEncode parameter:||(00)00801234999999999~m17|
|Human readable text:||(00) 008012349999999997|
|Data scanned from barcode:*||]C100008012349999999997|
|Global Trade Item Number (GTIN)|
|Text string sent to DataToEncode:||(01)3001234567890~m13|
|Human readable text:||(01) 30012345678906|
|Data scanned from barcode:*||]C10130012345678906|
Coupon with Expiration Date
|Coupon Extended Code (Offer Code and Expiration Date)|
|Human readable Text:||(8101) 0123450901|
Coupon with Household ID
|Coupon Extended Code (Offer Code and Household ID)|
|DataToEncode:||~21481007123452112345678 (Tilde Method)|
|Human readable text:||(8100) 712345 (21) 12345678|
Encoding two Variable Element Strings
FNC1 characters must be encoded between two or more variable length
|FNC1 Inserted Between Two Element Strings|
|Human readable text:||(10)345678(21)3456789012|
To obtain more information about the formatting and placement of GS1-128 barcodes, contact GS1.ORG.
* Many barcode scanners do not decode FNC1 codes. However, when the “format” option of the IDAutomation SC5USB Barcode Scanner is set to “UCC/EAN-128,” FNC1 codes are decoded as ]C1 for the first FNC1 and ASCII 29 (The <GS> character) for additional FNC1 codes as required by GS1. IDAutomation’s Barcode Scanner ASCII String Decoder may be used to view the <GS> character.
Most scanners with built-in decoders do not decode FNC1 codes in GS1-128 (UCC/EAN-128) barcodes. However, when the “format” option of the IDAutomation SC5USB Barcode Scanner is set to “UCC/EAN-128,” the scanner decodes FNC1 AI codes according to the UCC/EAN Application Identifier Standard.
According to this standard, the first FNC1 should be translated to the three text characters of ]C1, and next FNC1 codes should be translated to a field separator ASCII code 29 (The <GS> character) as demonstrated in Fig. 2.
Fig. 2: Decoding FNC-1 Codes with the
IDAutomation SC5 USB Barcode Scanner
|String used to create the barcode using IDAutomation products: Ê8100712345Ê2112345678|
| Barcode Created:
||The image to the left may be easily created using the Free Online Barcode Creator.|
|Decoded result from the IDAutomation SC5 USB Scanner:|
* The <GS> character is a group separator function, which is ASCII value 29. This character cannot be viewed or printed and therefore it may not appear to be present, unless an application is used such as IDAutomation’s Barcode Scanner ASCII String Decoder. If the SC5 USB Barcode Scanner is being used, the GS character can be reassigned to any ASCII character by changing the “field separator code” referred to in the manual. For example, this may be changed to the “|” character to make troubleshooting easier.
After making that change, the scanner would decode the symbol in Fig. 2 as follows: ]C18100712345|2112345678.
To program this change with the SC5 USB Barcode Scanner, perform the following:
- On the Code 128 programming page, scan Program.
- Scan Field Separator Code.
- Field separator codes are programmed into the scanner as a hexadecimal BASE-16 number. The pipe character “|” is ASCII 7C. From the Manual’s flip out page, scan 7, scan C and scan Finish.
- On the Code 128 page, scan Exit.