How to Create a GS1-128 Linear Bar Code

This article describes the use of the DesignMerge Linear Bar Code Module for creating variable GS1-128 linear bar codes. The Linear Bar Code Module is an optional component of the DesignMerge Pro and DesignMerge Catalog software packages that allows for the placement of fully variable linear (one-dimensional) bar codes in an Adobe InDesign document.

CHECK YOUR INDESIGN VERSION

The instructions presented here are for Adobe InDesign 2022 and newer versions of the software. If you are running Adobe InDesign 2021 or any older version, please click here to visit the Legacy Bar Code Documentation on this site.

ABOUT GS1-128

A GS1 Code 128 linear barcode (GS1-128) is a is a subset of Code 128 and is used extensively worldwide in shipping and packaging industries as a product identification code for the container and pallet levels in the supply chain.

The GS1-128 code was previously referred to as UCC-128 or EAN-128. Basically, the GS1-128 is a standard Code 128 bar code where the data to be encoded must follow a specific, predefined pattern, and the dimensions of the bar code must conform to the GS1 specification.

GS1-128 DATA REQUIREMENTS

The GS1-128 code has certain data and encoding requirements, several of which are automatically taken care of by the DesignMerge linear bar code module. For example, the actual encoding of the raw input data, as well as the required start and stop characters, are all calculated and added to the merged data automatically. However, there are certain other data requirements that must be met in order for the code to be certified as a GS1-128.

In brief, every GS1-128 barcode must begin with a special character known as a Function Code One (abbreviated as FNC1). To encode this data with DesignMerge, you should add the text ~212 to the start of your data. This can be added in the data file itself, or as a Prefix for the Variable Link that will read the data.

Immediately following the FNC1 character is a the Application Identifier (AI) number. The AI is generally two digits, which serve to define the specific purpose for the data that appears after it. The combination of the AI and its associated data is referred to as the Element String.

HOW TO CREATE A GS1-128 BARCODE

To create a simple GS1-128 barcode with a single Element String, please do the following:

  1. Create a Barcode Variable Link that will merge the GS1-128 data. Be sure to select Code 128 as the Barcode format.
  2. Add the text ~212 as a Prefix for the variable link. This will encode the required FNC1 character at the start of the GS1-128 data.
  3. Place the Variable Link in the document and apply the appropriate font. For GS1-128, please use the font MPS Bar Code UNV (XXS-XXL). Example: To create a GS1-128 with an X dimension of 10 and a height of 0.5 inches (one of the standard sizes), apply the MPS Bar Code UNV M (Medium Height) font with a a point size of 12.
    Note: Further bar code width and height adjustments can be applied in the normal fashion (for example, select different font drawings (XXS-XXL) to adjust the height of the font, adjust the point size applied, modify the horizontal or vertical scale applied, etc.) Please see the Linear Bar Code tutorial video for more details about such adjustments.


CHECK DIGIT CHARACTERS

GS1-128 codes typically require a check digit at the end of the code. A check digit is used to assist the scanning device in determining whether the encoded data was read accurately. Note: The data that is used to calculate the check digit should not include the AI.

Many times, the data to be encoded already contains the check digit character. For GS1-128, the only way to know this is to understand which type of bar code is being created, which can be derived from the AI utilized in the code.

For example, the SSCC-18 barcode (which is commonly used to uniquely identify shipping containers) has an AI of 00, followed by 17 digits, and ending with a single check digit. Here is an example of SSCC-18 formatted data that already includes the check digit:

If your data does not include a check digit character, and you need to add one to your GS1-128 data, you can add a check digit by placing the text ~m## where ## is a 2-digit number representing the number of characters preceding the tilde character on which to base the Mod 10 check digit calculation. Similar to the FNC1 character, the ~m## text can be added in the data file itself, or as a Suffix for the Variable Link that will read the data.

To add a check digit to a GS1-128 barcode with a single element string, please do the following:

  1. First, determine what type of a bar code is being created. This will be based on the AI that is being used. For this example, we are using an AI of 00, which indicates that 17 additional numbers should follow the AI, and the ending number will be the check digit (so a total of 18 digits following the AI when complete).
    Note: If your data already contains the check digit character (in this example, 18 digits following the AI), then the check digit has already been included in the data and there is no need to proceed with the remainder of these steps.
  2. Create or modify the Barcode Variable Link that will merge the GS1-128 data, as described in the previous section.
  3. Add the text ~m17 as a Suffix for the variable link. This indicates that there are 17 characters that precede the tilde character, and it is those characters only that will be used to calculate the required check digit character and add it to the end of the GS1-128 data.


  4. Place the bar code as described in the previous section.

With this change, DesignMerge software will calculate the check digit for the data automatically, and add the digit to the end of the encoded data.


HUMAN READABLE TEXT

Human Readable (HR) text is typically placed below the bar code (if required). For HR text, the AI codes are generally bracketed in parenthesis, optionally followed by a space, and then immediately followed by the remaining characters for the Element String.

DesignMerge does not provide a way to format the HR text in this fashion, so the HR formatting must occur separately, for example by formatting the data and placing it into a separate data field in the source Excel document.

For Microsoft Excel, the following formula will read the data from Cell A and encode the human readable version of the example GS1-128 data and place it into Cell B (note: this example assumes a 2-digit AI at the start of the data and a space between the AI and the remainder of the element string).

CONCATENATE("(", LEFT(A2,2), ") ", RIGHT(A2, (LEN(A2)-2)))

This results in in the following string conversion in the Excel file:

After exporting the Excel file to a new CSV, in order to implement the HR text simply create a separate Variable Link that reference the Human Readable data field, and place that link below the bar code, as shown below.

ADDITIONAL RESOURCES

Here are a few more resources that you may find helpful when working with GS1 barcodes.

GS1 Application Identifier (AI) Lists and Specifications

https://www.gs1.org/standards/barcodes/application-identifiers

https://www.barcodefaq.com/barcode-properties/definitions/gs1-application-identifiers/

GS1 General Specifications

https://ref.gs1.org/standards/genspecs/

GS1 Human Readable Guidelines

https://www.gs1.org/docs/barcodes/HRI_Implementation_Guide.pdf