BARCODE TOOLS

Generate GS1-Compliant Barcodes Easily with IronBarcode

Kannaopat Udonpant
Kannapat Udonpant
March 27, 2025
Share:

By embedding structured data formats, GS1 barcodes standardize product identification and traceability across supply chains. Developers can use IronBarcode to generate GS1-128, DataMatrix, or other compliant barcodes, leveraging predefined application identifiers (AIs) and strict syntax rules.

This guide details the step-by-step process for building barcodes programmatically, including how to embed FNC1 control characters and validate checksums to meet ISO/IEC specifications. Businesses implementing GS1 standards in retail, manufacturing, or distribution workflows gain better system integration, fewer manual data errors, and faster inventory turnover.

What is a GS1 Barcode?

Broken image Add from Pixabay, select from your files or drag and drop an image here.

GS1 barcodes are standardized identification systems that assign unique Global Trade Item Numbers (GTINs) to products, including the universal product code (UPC). These codes enable seamless tracking across global supply chains. GS1 barcodes automate inventory management, reduce manual errors, and improve retail, manufacturing, and distribution product traceability. Each consumer product variant receives a unique GTIN to ensure accurate tracking.

They support symbologies like GS1-128 and DataMatrix, which integrate with enterprise systems to streamline logistics and point-of-sale transactions. GS1 barcodes increase data accuracy by encoding structured data fields such as batch numbers and expiration dates. They also ensure compliance with industry regulations, making them indispensable for modern commerce infrastructure.

Below is a concise comparison table highlighting different types of GS1-supported barcodes and their typical applications.

Barcode Type

Typical Usage

Data Capacity

Key Features

EAN/UPC

Consumer product variants at retail POS

Up to 14 digits (primarily the GTIN)

Widely recognized; the most common barcode on retail items

GS1-128

Supply chain & logistics

Variable (can include batch, lot, and expiry)

Flexible format; often encodes additional product details

GS1 DataMatrix

Healthcare, electronics, high-value items

High capacity (can store GTIN plus extra fields)

Very compact; ideal for small products; excellent for traceability

GS1 QR Code

Marketing & consumer engagement

High capacity (can contain GTIN + URLs, etc.)

Can carry promotional information; easily scanned by smartphones

GS1 barcodes advance digital transformation initiatives by facilitating real-time data capture and analytics, bolstering supply chain visibility and decision-making. Their integration with innovative technologies such as the Internet of Things (IoT) and blockchain enhances security and traceability throughout the product lifecycle. This connectivity drives operational efficiencies and cost reductions and provides valuable insights into consumer behavior and market trends. It empowers businesses to innovate and maintain a competitive edge in a rapidly evolving global marketplace.

Why Use IronBarcode for GS1 Barcode Generation?

Generate GS1-Compliant Barcodes Easily with IronBarcode: Figure 2 - IronBarcode

IronBarcode delivers robust tools for generating GS1-compliant barcodes, including formats such as GS1-128, DataMatrix, and QR codes. The library enforces strict validation of key qualifiers like application identifiers (AIs) and calculates checksums automatically to meet ISO/IEC requirements. Developers can integrate it into .NET applications to produce and customize barcode or QR Code images programmatically.

Structured data encodings include key qualifiers like batch numbers, expiration dates, and lot numbers. These improve accuracy in inventory and product tracking workflows. Retail, healthcare, and logistics industries use these features to reduce manual errors. They also enhance interoperability with point-of-sale and warehouse management systems. Using an online barcode generator simplifies the process of creating GS1-compliant barcodes. For the programmatic generation, IronBarcode provides the absolute best results.

Step-by-Step Guide to Generating GS1-Compliant Barcodes with IronBarcode

This guide provides a detailed walkthrough for generating GS1-compliant barcodes (e.g., GS1-128) using the IronBarcode library in .NET. The process includes installation, barcode creation, customization, validation, and best practices.

1. Install IronBarcode library

To get started with GS1 barcode generation, install IronBarcode into your .NET project using NuGet Package Manager:

Install-Package BarCode
Install-Package BarCode
'INSTANT VB TODO TASK: The following line uses invalid syntax:
'Install-Package BarCode
$vbLabelText   $csharpLabel

Generate GS1-Compliant Barcodes Easily with IronBarcode: Figure 3 - Install IronBarcode

Alternatively, you can download it from the official website and manually add the reference to your project.

2. Create a Barcode

To generate a GS1 barcode, you must define the GTIN correctly and follow GS1 formatting standards. GS1-128 barcodes require structured data, including Application Identifiers (AIs) in parentheses. Below is the correct way to generate a GS1-128 barcode using IronBarcode:

using IronBarCode;
// Define GS1 barcode content with AI (01) for GTIN
var barcode = BarcodeWriter.CreateBarcode("(01)12345678901231", BarcodeEncoding.Code128GS1);
// Customize barcode settings
barcode.SetMargins(20);
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");
// Save barcode as an image
barcode.SaveAsPng("gs1_barcode.png");
using IronBarCode;
// Define GS1 barcode content with AI (01) for GTIN
var barcode = BarcodeWriter.CreateBarcode("(01)12345678901231", BarcodeEncoding.Code128GS1);
// Customize barcode settings
barcode.SetMargins(20);
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");
// Save barcode as an image
barcode.SaveAsPng("gs1_barcode.png");
Imports IronBarCode
' Define GS1 barcode content with AI (01) for GTIN
Private barcode = BarcodeWriter.CreateBarcode("(01)12345678901231", BarcodeEncoding.Code128GS1)
' Customize barcode settings
barcode.SetMargins(20)
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode")
' Save barcode as an image
barcode.SaveAsPng("gs1_barcode.png")
$vbLabelText   $csharpLabel

Generate GS1-Compliant Barcodes Easily with IronBarcode: Figure 4 - GS1 Barcode Output

This implementation results in a barcode compliant with GS1 standards, suitable for product packaging, warehouse management, and supply chain logistics. Always validate the GTIN and test the barcode with scanners to ensure it is scanned correctly and confirm compatibility with inventory and point-of-sale systems.

3. Customize the Barcode Image

IronBarcode provides extensive customization options to modify barcode dimensions, colors, margins, and annotations, maintaining clarity and brand consistency. Using one barcode format across all systems reduces complexity, and customization improves barcode readability across different scanners and devices.

Here’s how you can customize a GS1 barcode effectively:

// Adjust barcode size for better scanning
barcode.ResizeTo(500, 250);
// Change barcode color to match branding requirements
barcode.ChangeBarCodeColor(System.Drawing.Color.DarkBlue);
// Set margins to ensure clear spacing around the barcode
barcode.SetMargins(20);
// Add annotation text below the barcode for better identification
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");
// Save barcode in different formats as needed
barcode.SaveAsJpeg("custom_barcode.jpg");
barcode.SaveAsPng("custom_barcode.png");
// Adjust barcode size for better scanning
barcode.ResizeTo(500, 250);
// Change barcode color to match branding requirements
barcode.ChangeBarCodeColor(System.Drawing.Color.DarkBlue);
// Set margins to ensure clear spacing around the barcode
barcode.SetMargins(20);
// Add annotation text below the barcode for better identification
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode");
// Save barcode in different formats as needed
barcode.SaveAsJpeg("custom_barcode.jpg");
barcode.SaveAsPng("custom_barcode.png");
' Adjust barcode size for better scanning
barcode.ResizeTo(500, 250)
' Change barcode color to match branding requirements
barcode.ChangeBarCodeColor(System.Drawing.Color.DarkBlue)
' Set margins to ensure clear spacing around the barcode
barcode.SetMargins(20)
' Add annotation text below the barcode for better identification
barcode.AddAnnotationTextBelowBarcode("GS1-128 Barcode")
' Save barcode in different formats as needed
barcode.SaveAsJpeg("custom_barcode.jpg")
barcode.SaveAsPng("custom_barcode.png")
$vbLabelText   $csharpLabel

By customizing these elements, businesses optimize barcode performance for printing and scanning, achieving compliance with GS1 standards and improved operational efficiency.

4. Save and Validate the Barcode

After generating the barcode, it must be persisted in formats compatible with both printing and digital applications. High-resolution formats such as PNG, JPEG, and PDF are recommended to maintain scanability during resizing or physical printing. Here’s how to save the barcode in different formats:

// Save barcode as PNG for digital use
barcode.SaveAsPng("final_barcode.png");
// Save barcode as JPEG for printing
barcode.SaveAsJpeg("final_barcode.jpg");
// Save barcode as a PDF for documentation purposes
barcode.SaveAsPdf("final_barcode.pdf");
// Save barcode as PNG for digital use
barcode.SaveAsPng("final_barcode.png");
// Save barcode as JPEG for printing
barcode.SaveAsJpeg("final_barcode.jpg");
// Save barcode as a PDF for documentation purposes
barcode.SaveAsPdf("final_barcode.pdf");
' Save barcode as PNG for digital use
barcode.SaveAsPng("final_barcode.png")
' Save barcode as JPEG for printing
barcode.SaveAsJpeg("final_barcode.jpg")
' Save barcode as a PDF for documentation purposes
barcode.SaveAsPdf("final_barcode.pdf")
$vbLabelText   $csharpLabel

Post-saving, the barcode must undergo validation to verify its machine-readability across diverse scanning systems. This process confirms compliance with GS1 specifications and mitigates scanning errors in production environments. The validation routine typically involves decoding attempts using standard barcode reader libraries:

// Validate the barcode by attempting to read it
bool isValid = BarcodeReader.Read("final_barcode.png").Any();
Console.WriteLine($"Barcode is valid: {isValid}");
// Validate the barcode by attempting to read it
bool isValid = BarcodeReader.Read("final_barcode.png").Any();
Console.WriteLine($"Barcode is valid: {isValid}");
' Validate the barcode by attempting to read it
Dim isValid As Boolean = BarcodeReader.Read("final_barcode.png").Any()
Console.WriteLine($"Barcode is valid: {isValid}")
$vbLabelText   $csharpLabel

Generate GS1-Compliant Barcodes Easily with IronBarcode: Figure 5 - Validate Barcode

Systematic validation prevents operational disruptions caused by unscannable codes in supply chain management systems, point-of-sale interfaces, and inventory databases. It is a critical quality control measure, particularly for high-volume printing operations, where error correction costs escalate exponentially.

Conclusion

Generate GS1-Compliant Barcodes Easily with IronBarcode: Figure 6 - Licensing

Generating GS1 barcodes using IronBarcode is a simple and effective way to improve product identification and streamline supply chain management. With its powerful features, businesses can create barcodes that comply with global standards, ensuring seamless tracking from production to point-of-sale and products online.

IronBarcode offers developers a free trial to explore its functionalities before committing to a purchase. Licensing starts at $749, offering a cost-effective and scalable solution for companies looking to implement barcode generation efficiently.

Kannaopat Udonpant
Software Engineer
Before becoming a Software Engineer, Kannapat completed a Environmental Resources PhD from Hokkaido University in Japan. While pursuing his degree, Kannapat also became a member of the Vehicle Robotics Laboratory, which is part of the Department of Bioproduction Engineering. In 2022, he leveraged his C# skills to join Iron Software's engineering team, where he focuses on IronPDF. Kannapat values his job because he learns directly from the developer who writes most of the code used in IronPDF. In addition to peer learning, Kannapat enjoys the social aspect of working at Iron Software. When he's not writing code or documentation, Kannapat can usually be found gaming on his PS5 or rewatching The Last of Us.
NEXT >
Step-by-Step Guide to Using QR Code Chimp Generator