Skip to footer content
USING IRONQR

QR Code .NET Core Generator & Reader | IronQR

Creating a QR code generator in .NET Core is straightforward when you choose the right library. When evaluating the requirements for a QR code generator, developers look for a balance between ease of use and optional advanced features. Whether building ASP.NET Core web applications or console tools, developers need a reliable library that handles everything from basic QR code creation to advanced customization.

IronQR delivers a powerful solution for .NET Core that supports encoding text strings, URLs, and Japanese Unicode text. While some may initially look for a .NET open source library such as the QRCoder library (known for its permissive MIT license), IronQR provides an enterprise-grade alternative with machine-learning capabilities and dedicated support.

This tutorial demonstrates how to generate QR codes, configure error correction levels, and read existing codes using machine learning-powered detection, all within your .NET Core projects.

Get started with IronQR today using a free trial.

Get stated with IronQR now.
green arrow pointer

How Do You Install a QR Code Library in .NET Core?

To begin, open Visual Studio and click the create button to start a new project. Once you have assigned a project name, installing the library through the NuGet Package Manager takes seconds. While some developers might search for the QRCoder NuGet package, you can install the IronQR framework by running the following command in the Package Manager Console:

Install-Package IronQR

Alternatively, use the NuGet Package Manager UI by searching for "IronQR" and clicking the install button. The library provides a .NET implementation compatible with .NET Core 3.x, .NET 5, 6, 7, 8, 9, and 10, making it ideal for modern web development and multi-platform projects.

After installation, add the required using directives at the top of your file. IronQR integrates with IronSoftware.Drawing for cross-platform image handling, eliminating the need for platform-specific dependencies such as System.Drawing.Common, which was deprecated for cross-platform use in .NET 6 and later.

You can verify the installation succeeded by checking your project's package references in the .csproj file or by confirming the NuGet package appears in the Package Manager console output. Once installed, the IronQR API reference becomes available immediately.

How Do You Generate a QR Code?

The QrWriter class, often used alongside convenient extension methods, makes generating QR codes straightforward. Here is the source code for a complete example using top-level statements to generate a QR code in just a few lines of code:

using IronQr;
using IronSoftware.Drawing;

// Generate a QR code from input text
QrCode qrcode = QrWriter.Write("https://ironsoftware.com");

// Save as PNG image
AnyBitmap qrImage = qrcode.Save();
qrImage.SaveAs("website-qr.png");
using IronQr;
using IronSoftware.Drawing;

// Generate a QR code from input text
QrCode qrcode = QrWriter.Write("https://ironsoftware.com");

// Save as PNG image
AnyBitmap qrImage = qrcode.Save();
qrImage.SaveAs("website-qr.png");
$vbLabelText   $csharpLabel

Output

QR Code Generator .NET Core: Create and Read Quick Response Codes in C#: Image 1 - QR created from the URL

The QrWriter.Write() method processes the data into QrCodeData, which contains the raw modules (the black and white squares) of the QR symbol. IronQR uses internal payload generators to ensure the input text is efficiently encoded for numeric data, alphanumeric text strings, or byte arrays.

The AnyBitmap class from IronSoftware.Drawing provides cross-platform image saving, so the same code works on Windows, macOS, and Linux without modification. You can save the output as PNG, JPEG, or other supported formats depending on your use case.

For a working demonstration, see the generate QR code example page which shows additional configuration options alongside the basic generation workflow.

What Are Error Correction Levels and Why Do They Matter?

Error correction determines how much damage a QR symbol can sustain while remaining scannable. This is one of the optional advanced features that allows for branding and durability. The QR code standard (ISO/IEC 18004) defines four levels of error correction, each trading data capacity for resilience.

QR Code Error Correction Levels and Their Use Cases
Level Data Recovery Best For
L (Low) ~7% Clean digital displays
M (Medium) ~15% General purpose use
Q (Quartile) ~25% Printed materials
H (High) ~30% Harsh environments, logo overlays

Configure error correction using QrOptions:

using IronQr;
using IronSoftware.Drawing;

// Configure with high error correction level
var options = new QrOptions(QrErrorCorrectionLevel.High, 20);

// Generate QR code with options
QrCode qrcode = QrWriter.Write("Product-12345", options);
AnyBitmap qrImage = qrcode.Save();
qrImage.SaveAs("product-qr.png");
using IronQr;
using IronSoftware.Drawing;

// Configure with high error correction level
var options = new QrOptions(QrErrorCorrectionLevel.High, 20);

// Generate QR code with options
QrCode qrcode = QrWriter.Write("Product-12345", options);
AnyBitmap qrImage = qrcode.Save();
qrImage.SaveAs("product-qr.png");
$vbLabelText   $csharpLabel

QR Output

QR Code Generator .NET Core: Create and Read Quick Response Codes in C#: Image 2 - Generated QR code with error correction

The second parameter specifies the maximum version number allowed, controlling the QR code's size and data capacity. Higher error correction is essential when adding a logo image or for physical wear scenarios.

When you plan to overlay a logo on a QR code, always use Level H. The additional redundancy compensates for the modules hidden by the logo, keeping the code scannable. The IronQR error correction documentation explains how version selection interacts with data capacity and correction level.

How Do You Customize QR Code Appearance with Logo and Colors?

IronQR's QrStyleOptions enables brand-aligned QR code generation with custom colors, dimensions, and embedded logos. This is particularly useful for marketing materials, product packaging, and event tickets where visual consistency matters.

using IronQr;
using IronSoftware.Drawing;

var styleOptions = new QrStyleOptions
{
    Dimensions = 300,
    Margins = 10,
    Color = Color.DarkBlue,
    Logo = new QrLogo { Bitmap = AnyBitmap.FromFile("company-logo.png") }
};

QrCode qrcode = QrWriter.Write("https://yourcompany.com");
AnyBitmap qrImage = qrcode.Save(styleOptions);
qrImage.SaveAs("branded-qr.png");
using IronQr;
using IronSoftware.Drawing;

var styleOptions = new QrStyleOptions
{
    Dimensions = 300,
    Margins = 10,
    Color = Color.DarkBlue,
    Logo = new QrLogo { Bitmap = AnyBitmap.FromFile("company-logo.png") }
};

QrCode qrcode = QrWriter.Write("https://yourcompany.com");
AnyBitmap qrImage = qrcode.Save(styleOptions);
qrImage.SaveAs("branded-qr.png");
$vbLabelText   $csharpLabel

Styled QR Code

QR Code Generator .NET Core: Create and Read Quick Response Codes in C#: Image 3 - Styled QR code output

The Dimensions property sets the output image size in pixels. The Margins property controls the quiet zone -- the blank border around the QR code that scanners need to correctly identify the symbol boundary. The QR code customization guide covers additional styling properties including background color and module shape options.

When embedding a logo, keep it to no more than 30% of the QR code's total area. Exceeding this threshold can compromise readability even at Level H correction. Testing with multiple QR scanner applications after customization is good practice.

How Do You Generate QR Codes in ASP.NET Core?

Integrating QR code generation into ASP.NET Core follows the Model View Controller pattern. Here is a HomeController class implementation that returns a QR code image directly from an action method:

using IronQr;
using IronSoftware.Drawing;
using Microsoft.AspNetCore.Mvc;

namespace Examples
{
    public class HomeController : Controller
    {
        public IActionResult GenerateQR(string content)
        {
            QrCode myQr = QrWriter.Write(content);
            AnyBitmap qrImage = myQr.Save();
            byte[] imageBytes = qrImage.ExportBytes();
            return File(imageBytes, "image/png");
        }
    }
}
using IronQr;
using IronSoftware.Drawing;
using Microsoft.AspNetCore.Mvc;

namespace Examples
{
    public class HomeController : Controller
    {
        public IActionResult GenerateQR(string content)
        {
            QrCode myQr = QrWriter.Write(content);
            AnyBitmap qrImage = myQr.Save();
            byte[] imageBytes = qrImage.ExportBytes();
            return File(imageBytes, "image/png");
        }
    }
}
$vbLabelText   $csharpLabel

This endpoint accepts QR code data as a parameter and returns the generated PNG image directly. The approach works with ASP.NET Core Web API projects and Razor views alike.

For production ASP.NET Core applications, consider caching frequently generated QR codes using IMemoryCache or IDistributedCache to reduce CPU overhead. QR codes for static URLs, product identifiers, or event links do not change between requests and are ideal candidates for caching.

You can also integrate IronQR into a Minimal API endpoint. The ASP.NET Core integration tutorial provides a complete example including dependency injection patterns and how to serve QR code images from a Blazor component.

Registering IronQR's license key in Program.cs using the top-level statement pattern keeps startup configuration clean:

using IronQr;

IronQr.License.LicenseKey = "YOUR-LICENSE-KEY";
using IronQr;

IronQr.License.LicenseKey = "YOUR-LICENSE-KEY";
$vbLabelText   $csharpLabel

Set the license key before calling any IronQR methods. In development, you can apply a free trial key obtained from the IronQR licensing page.

How Do You Encode Japanese Unicode Text?

IronQR supports encoding Japanese Unicode text through Kanji mode, which efficiently encodes Japanese unicode characters using fewer data segments than standard encoding. This reduces the QR code's version (size) for the same content, producing a less complex symbol that scans faster.

using IronQr;
using IronSoftware.Drawing;

// Generate QR that encodes Japanese Unicode text
QrCode japaneseQr = QrWriter.Write("こんにちは世界");
AnyBitmap qrImage = japaneseQr.Save();
qrImage.SaveAs("japanese-qr.png");
using IronQr;
using IronSoftware.Drawing;

// Generate QR that encodes Japanese Unicode text
QrCode japaneseQr = QrWriter.Write("こんにちは世界");
AnyBitmap qrImage = japaneseQr.Save();
qrImage.SaveAs("japanese-qr.png");
$vbLabelText   $csharpLabel

Output

QR Code Generator .NET Core: Create and Read Quick Response Codes in C#: Image 4 - QR code encoded with Japanese Unicode text

The library automatically selects Kanji mode when it detects Japanese characters, optimizing the QR code's data capacity without manual configuration of data segments. This matters for applications targeting Japanese-speaking users, such as e-commerce platforms, restaurant menus, or travel information kiosks.

Kanji mode encodes characters from the Shift JIS character set. If your application processes both Japanese and Latin text in the same string, IronQR handles the mode switching internally, selecting the most efficient encoding for each segment. For internationalization best practices in .NET, the Microsoft globalization documentation provides helpful context on character encoding.

How Do You Read QR Codes with Machine Learning?

IronQR distinguishes itself through its machine learning-powered QR reader. The ML model achieves high accuracy even reading QR codes from angles or partially obscured images -- a significant advantage over traditional threshold-based detection algorithms used in many open source alternatives.

using IronQr;
using IronSoftware.Drawing;

// Load image containing QR code
AnyBitmap inputBmp = AnyBitmap.FromFile("scanned-document.png");
QrImageInput imageInput = new QrImageInput(inputBmp);

// Read with ML-powered detection
QrReader reader = new QrReader();
IEnumerable<QrResult> results = reader.Read(imageInput);

foreach (var result in results)
{
    Console.WriteLine($"Found: {result.Value}");
}
using IronQr;
using IronSoftware.Drawing;

// Load image containing QR code
AnyBitmap inputBmp = AnyBitmap.FromFile("scanned-document.png");
QrImageInput imageInput = new QrImageInput(inputBmp);

// Read with ML-powered detection
QrReader reader = new QrReader();
IEnumerable<QrResult> results = reader.Read(imageInput);

foreach (var result in results)
{
    Console.WriteLine($"Found: {result.Value}");
}
$vbLabelText   $csharpLabel

QR Code Read Output

QR Code Generator .NET Core: Create and Read Quick Response Codes in C#: Image 5 - Data read from QR Code

The QrResult object contains the decoded value along with position metadata, which you can use to highlight the detected QR code region in UI overlays or document processing pipelines. This capability makes IronQR ideal for document processing and inventory management systems.

The ML model runs entirely on-device with no cloud API calls required, making it suitable for air-gapped environments and offline applications. Traditional CV-based detectors such as ZXing.NET work well for clean, front-facing codes but often struggle with real-world conditions like glare, rotation, or damage. IronQR's ML approach handles these scenarios reliably.

For batch document processing, you can pass multiple images to the reader in sequence and collect all results. The QR code reading documentation covers reading from PDF pages and camera streams in addition to static image files.

How Does Cross-Platform Support Work?

Unlike solutions dependent on System.Drawing.Common (deprecated for cross-platform use in .NET 6+), IronQR uses IronSoftware.Drawing for true multi-platform projects. Your code runs consistently across Windows, macOS, Linux, iOS, and Android. For multi-platform projects, SkiaSharp alternatives are unnecessary -- IronQR handles platform abstraction internally.

The .NET cross-platform documentation explains the broader platform compatibility story for .NET 10. IronQR aligns with these principles by avoiding platform-specific APIs entirely.

IronQR supports the following deployment targets:

  • .NET 10, 9, 8, 7, 6 -- all modern .NET versions
  • .NET Core 3.x -- for applications that have not yet migrated to modern .NET
  • Xamarin and MAUI -- for mobile application development
  • Azure Functions and AWS Lambda -- for serverless workloads

When running in Docker containers, no additional system packages are needed beyond the standard .NET runtime image. This simplifies your Dockerfile compared to libraries that require native GDI+ dependencies. The IronQR deployment guide covers configuration for containerized and cloud environments.

How Do You Compare IronQR to Other .NET QR Libraries?

Several .NET QR code libraries exist, each with different trade-offs. Understanding the differences helps you choose the right tool for your project.

QRCoder is an open source library with an MIT license. It works well for straightforward QR code generation but does not include QR code reading capabilities or machine learning-powered detection. Its output options are more limited compared to IronQR's styled output support.

ZXing.NET is a C# port of the Java ZXing library. It supports both reading and writing but relies on traditional computer vision techniques that struggle with damaged or rotated codes. Cross-platform image handling requires additional setup.

IronQR provides generation and reading in a single package, with enterprise licensing that includes dedicated support. The ML-powered reader, styled output, and IronSoftware.Drawing integration make it a more complete solution for production applications.

For a detailed feature comparison, see the IronQR vs QRCoder comparison and the IronQR vs ZXing comparison articles.

What Are Your Next Steps?

IronQR provides a complete solution for QR code generation and reading in .NET Core. By handling complex payload generators and the assembly of raw modules and QrCodeData data automatically, it simplifies the development cycle. Whether you need a simple open source library alternative or a system with optional advanced features, IronQR's cross-platform architecture ensures reliable operation.

To continue building with IronQR, explore these resources:

Start your free trial to unlock IronQR's full potential without any upfront commitment.

Frequently Asked Questions

How can I generate QR codes in .NET Core using IronQR?

You can generate QR codes in .NET Core by utilizing IronQR, which offers an easy-to-use library that allows for basic QR code creation as well as advanced customization features.

What customization options are available with IronQR for QR code generation?

IronQR provides various customization options, including configuring error correction levels and adding logos to your QR codes, ensuring they meet your specific requirements.

Can IronQR handle QR code generation in ASP.NET Core web applications?

Yes, IronQR is fully compatible with ASP.NET Core web applications, allowing developers to integrate QR code generation into their projects.

Is it possible to read QR codes with IronQR in .NET Core?

Absolutely, IronQR is designed to read QR codes with high accuracy, leveraging machine learning technology to ensure precise detection and data extraction.

What makes IronQR suitable for developers looking for a QR code generator?

IronQR offers a balance between ease of use and advanced features, making it an ideal choice for developers who need a versatile and reliable QR code library.

Are there any advanced features for QR code processing in IronQR?

Yes, IronQR includes advanced features such as configuring error correction, adding branding elements, and handling various QR code formats.

How does IronQR ensure the accuracy of QR code reading?

IronQR utilizes machine learning-powered algorithms to enhance the accuracy of QR code reading, ensuring reliable data capture even in challenging conditions.

Jordi Bardia
Software Engineer
Jordi is most proficient in Python, C# and C++, when he isn’t leveraging his skills at Iron Software; he’s game programming. Sharing responsibilities for product testing, product development and research, Jordi adds immense value to continual product improvement. The varied experience keeps him challenged and engaged, and he ...
Read More

Iron Support Team

We're online 24 hours, 5 days a week.
Chat
Email
Call Me