---
title: "How to Generate GS1 QR Codes in Blazor Using Barcode Generator"
published_at: "2026-12-03T15:30:00+00:00"
modified_at: "2026-12-03T15:30:00+00:00"
url: "https://www.syncfusion.com/blogs/post/generate-gs1-qr-codes-in-blazor"
excerpt: "Discover how to generate GS1 QR Codes in Blazor using Syncfusion Barcode Generator. Learn to encode GTINs, batch numbers, and expiration dates, configure error correction, and validate barcode input for product identification and traceability."
taxonomy_category:
  - "Barcode Generator"
  - "Blazor"
  - "Productivity"
  - "UI components"
  - "Web"
  - "What's new"
taxonomy_post_tag:
  - "Barcode Generator"
  - "Blazor"
  - "Productivity"
  - "UI components"
  - "Web"
  - "What's New"
---

# How to Generate GS1 QR Codes in Blazor Using Barcode Generator

[Suganthi Karuppannan](https://www.syncfusion.com/blogs/author/suganthi-karuppannan)

![How to Generate GS1 QR Codes in Blazor Using Barcode Generator](https://www.syncfusion.com/blogs/images/posts/generate-gs1-qr-codes-in-blazor/how-to-generate-gs1-qr-codes-in-blazor-using-barcode-generator.jpg)

**TL;DR:** Discover how to generate GS1 QR Codes in Blazor using Syncfusion Barcode Generator. Learn to encode GTINs, batch numbers, and expiration dates, configure error correction, and validate barcode input for product identification and traceability.

Imagine scanning a product label and immediately retrieving its GTIN, batch number, and expiration date. For businesses handling thousands of products, this information is essential for inventory management, product tracking, and recall operations.

To make this possible, product information must follow a format that different systems can understand consistently. **GS1 Application Identifiers (AIs)** provide this standard by defining what each piece of product data represents.

In this blog, you'll learn how to generate QR Codes containing GS1-formatted data using the Syncfusion® [Blazor Barcode Generator](https://www.syncfusion.com/blazor-components/blazor-barcode "Blazor Barcode Generator"). We'll explore how to configure GS1 processing, generate QR Codes, set error-correction levels, and validate input data.

## Why use GS1-formatted data in QR Codes?

Consider two businesses storing the same product information differently:

- Business A: `LOT=ABC123;EXP=2028-12-31`
- Business B: `Batch:ABC123;Expiry:31/12/2028`

Although both formats contain similar information, applications may need custom logic to interpret them. This can make data exchange between systems more complicated.

GS1 solves this problem through Application Identifiers, which define the meaning and format of product data.

For example:

| Application Identifier | Meaning                         |
| ---------------------- | ------------------------------- |
| (01)                   | Global Trade Item Number (GTIN) |
| (17)                   | Expiration date                 |
| (10)                   | Batch or lot number             |
| (21)                   | Serial number                   |

By using these identifiers, applications can interpret product information consistently across manufacturing, retail, healthcare, and logistics workflows.

QR Codes can also store multiple pieces of product information in a single symbol. This makes them useful for product labels, inventory tracking, and supply-chain operations.

The retail industry is also moving toward wider adoption of 2D barcodes through the GS1 Sunrise 2027 initiative. However, it is important to distinguish between a QR Code containing a GS1 element string and a retail GS1 Digital Link QR Code. They use different data formats. The example in this blog demonstrates GS1 element-string processing, not GS1 Digital Link generation.

## Generate a QR Code with GS1-formatted data in Blazor

The Syncfusion Blazor Barcode Generator provides the `SfQRCodeGenerator` component to generate QR Codes. Its `EnableGS1` property enables GS1-specific processing of the input supplied through the `Value` property.

Let's create a Blazor application and generate a QR Code containing product information.

### Prerequisites

Before getting started, ensure you have:

- [.NET SDK 8 or later](https://dotnet.microsoft.com/en-us/download/dotnet "Download .NET SDK").
- [Visual Studio 2022](https://visualstudio.microsoft.com/vs/older-downloads/ "Visual Studio 2022") or [Visual Studio Code](https://code.visualstudio.com/ "Visual Studio Code") with the C# extension.

### Step 1: Create a Blazor web app

Create a new Blazor Web App by following the Syncfusion [Barcode Generator getting-started guide](https://helpstaging.syncfusion.com/chart-sdk/blazor/barcode-generator/getting-started-with-web-app "GS1 barcode generator in Blazor documentation").

### Step 2: Install and register the package

Install the [Syncfusion.Blazor.BarcodeGenerator](https://www.nuget.org/packages/Syncfusion.Blazor.BarcodeGenerator "Syncfusion.Blazor.BarcodeGenerator NuGet package") NuGet package.

Register Syncfusion services in the **Program.cs** file:

```csharp
using Syncfusion.Blazor;
builder.Services.AddSyncfusionBlazor();
```

### Step 3: Generate a GS1 QR Code

Open the **Pages/Index.razor** file and add the following code:

```razor
@using Syncfusion.Blazor.BarcodeGenerator

<SfQRCodeGenerator Width="250px" Height="250px"
                   Value="(01)09506000134352(17)281231(10)ABC123"
                   EnableGS1="true">
    <QRCodeGeneratorDisplayText Text="Product Code" Visibility="true"
                                Alignment="Alignment.Center" />
</SfQRCodeGenerator>
```

This example generates a QR Code containing three GS1 Application Identifiers:

| AI   | Data           | Meaning                            |
| ---- | -------------- | ---------------------------------- |
| (01) | 09506000134352 | GTIN                               |
| (17) | 281231         | Expiration date: December 31, 2028 |
| (10) | ABC123         | Batch or lot number                |

Here's what the important properties do:

- `Value`: Specifies the GS1-formatted data to encode in the QR Code.
- `EnableGS1`: Enables GS1-specific processing and validation.
- `Width` and `Height`: Define the dimensions of the QR Code.
- `QRCodeGeneratorDisplayText`: Displays the specified text alongside the generated QR Code.

![Generating a GS1 QR Code using Blazor Barcode Generator](https://www.syncfusion.com/blogs/images/posts/generate-gs1-qr-codes-in-blazor/generating-a-gs1-qr-code-using-blazor-barcode-generator.png "Generating a GS1 QR Code using Blazor Barcode Generator")

The parentheses around Application Identifiers are used for human-readable representation. They are not encoded as part of the GS1 data.

**Note:** This example uses a GS1 element string. It does not generate a GS1 Digital Link URI. If your application targets retail point-of-sale systems, verify the required GS1 barcode format and scanner compatibility.

### Step 4: Configure error correction

QR Codes support four error-correction levels. These levels determine how much damage a QR Code can tolerate while remaining readable.

| Level    | Approximate recovery capacity |
| -------- | ----------------------------- |
| Low      | 7%                            |
| Medium   | 15%                           |
| Quartile | 25%                           |
| High     | 30%                           |

Choose an appropriate level based on how the QR Code will be printed and used:

- **Low:** Suitable for clean labels with minimal risk of damage.
- **Medium:** A balanced option for general-purpose product labels.
- **Quartile:** Useful when labels may experience moderate wear or damage.
- **High:** Provides greater error-correction capability when labels may be exposed to harsher conditions.

You can configure the error-correction level using the `ErrorCorrectionLevel` property:

```razor
<SfQRCodeGenerator Width="250px" Height="250px"
                   Value="(01)09506000134352(17)281231(10)ABC123"
                   EnableGS1="true"
                   ErrorCorrectionLevel="ErrorCorrectionLevel.High">
</SfQRCodeGenerator>
```

In this example, `ErrorCorrectionLevel.High` provides the highest of the four supported correction levels.

Higher error correction can increase the QR Code's complexity and density. The actual scanning success also depends on symbol size, print quality, contrast, quiet zone, and scanner capability. Test the selected level with your production labels and scanners.

### Step 5: Validate input before generating the QR Code

Product information often comes from application databases or user input. Invalid data can cause problems during barcode generation and scanning.

The [OnValidationFailed](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.BarcodeGenerator.SfQRCodeGenerator.html#Syncfusion_Blazor_BarcodeGenerator_SfQRCodeGenerator_OnValidationFailed "OnValidationFailed event in Blazor Barcode Generator") event helps identify invalid barcode input so your application can respond appropriately.

Let's connect the event to the QR Code Generator:

```razor
@using Syncfusion.Blazor.BarcodeGenerator

<SfQRCodeGenerator Value="@gs1Data"
                   EnableGS1="true"
                   Width="220px"
                   Height="220px"
                   OnValidationFailed="@OnValidationFailed">
</SfQRCodeGenerator>

@code {
    private string gs1Data =
        "(01)09506000134352(17)281231(10)ABC123";

    private void OnValidationFailed(ValidationFailedEventArgs args)
    {
        Console.WriteLine($"GS1 QR validation error: {args.Message}");
    }
}
```

When the component encounters invalid barcode input, the `OnValidationFailed` event provides the validation message through `args.Message`. You can use this event to log the issue or notify users.

For example, you can test the validation behavior by supplying an incorrectly formatted GTIN in the input. Check the resulting event message to understand the validation feedback provided by the component.

**Note:** Component-level validation checks the barcode input format. It does not verify whether a GTIN belongs to a particular product or whether a batch number exists in your database. Implement those business-specific checks separately.

## Best practices for GS1 QR Codes

Keep the following points in mind when generating GS1 QR Codes for real-world applications:

- **Use valid GS1 data:** Follow the Application Identifier rules and required data formats. Pay particular attention to variable-length fields such as AI (10). If another element follows a variable-length field, handle the required separator according to GS1 encoding rules.
- **Maintain a quiet zone:** Keep sufficient whitespace around the QR Code so scanners can identify its boundaries.
- **Use strong contrast:** Dark modules on a light background generally provide better scanning reliability.
- **Avoid unnecessary logos:** Prioritize the readability of product identification codes over decorative elements.
- **Use live product data:** Generate GS1 strings from product, batch, and expiration records instead of entering values manually.
- **Test with production scanners:** Verify printed QR Codes using the actual label sizes, printing devices, and scanners used in your workflow.

## Frequently Asked Questions

### What makes a GS1 QR Code different from a standard QR Code?

A GS1 QR Code uses GS1 Application Identifiers (AIs) to encode structured business data such as GTINs, batch/lot numbers, expiration dates, and serial numbers. This standardized format allows barcode scanners and business systems to consistently identify and process the encoded information.

### Can a GS1 QR Code contain multiple data elements?

Yes. A single GS1 QR Code can store multiple GS1 Application Identifiers, enabling you to combine information such as a product's GTIN, batch number, expiration date, and serial number within a single symbol.

### Why is EnableGS1 required?

Setting `EnableGS1="true"` tells the component to validate and encode the input according to GS1 specifications. Without this setting, the value is treated as standard text and is not formatted as GS1-compliant data.

### Which industries commonly use GS1 QR Codes?

GS1 QR Codes are widely used in retail, healthcare, food and beverage, manufacturing, logistics, and supply chain management. They help organizations improve product identification, traceability, inventory management, and regulatory compliance.

## Conclusion

GS1 Application Identifiers make it easier to represent product information such as GTINs, batch numbers, and expiration dates in a standardized format. With the Syncfusion [Blazor Barcode Generator](https://www.syncfusion.com/blazor-components/blazor-barcode "Blazor Barcode Generator"), you can generate QR Codes containing GS1-formatted data, configure error correction, and handle invalid input through validation events.

Explore the Syncfusion Blazor Barcode Generator [documentation](https://help.syncfusion.com/chart-sdk/blazor/barcode-generator/gs1barcodes "Blazor Barcode Generator documentation"), online [demos](https://blazor.syncfusion.com/demos/barcodes/gs1-qr-code?theme=fluent2 "Blazor Barcode Generator demos"), and [GitHub samples](https://github.com/syncfusion/blazor-samples "Syncfusion Blazor GitHub demos") to learn more.

The Barcode Generator is also available in Syncfusion [Angular](https://www.syncfusion.com/angular-components/angular-barcode "Angular Barcode Generator"), [React](https://www.syncfusion.com/react-components/react-barcode "React Barcode Generator"), [Vue](https://www.syncfusion.com/vue-components/vue-barcode "Vue Barcode Generator"), and [JavaScript](https://www.syncfusion.com/javascript-ui-controls/js-barcode "JavaScript Barcode Generator") components.

If you're a Syncfusion user, download the latest setup from the [license and downloads](https://www.syncfusion.com/sales/teamlicense "Syncfusion license and downloads page") page. New users can explore the features with a [free 30-day trial](https://www.syncfusion.com/downloads "Get free evaluation of the Syncfusion products").

For questions or assistance, contact us through the Syncfusion [support forum](https://www.syncfusion.com/forums "Syncfusion support forum"), [support portal](https://support.syncfusion.com/ "Syncfusion support portal"), or [feedback portal](https://www.syncfusion.com/feedback/ "Syncfusion feedback portal").
