Skip to footer content
USING IRONQR

QR Code Generator .NET Core: Create and Read Quick Response Codes in C#

Creating a QR Code generator in .NET Core has never been more straightforward. 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.

How Do You Generate a QR Code?

The QrWriter class, often used alongside convenient extension methods, makes generating QR codes remarkably simple. Here is the source code for a complete example using the traditional namespace and class structure to generate a QR code in just a few lines of code:

using IronQr;
using IronSoftware.Drawing;
namespace Examples
{
    public class QRCodeGenerator
    {
        public static void Main(string[] args)
        {
            // Generate a QR code from input text
            var qrcode = QrWriter.Write("https://ironsoftware.com");
            // Save as PNG image
            AnyBitmap qrImage = qrcode.Save();
            qrImage.SaveAs("website-qr.png");
        }
    }
}
using IronQr;
using IronSoftware.Drawing;
namespace Examples
{
    public class QRCodeGenerator
    {
        public static void Main(string[] args)
        {
            // Generate a QR code from input text
            var qrcode = QrWriter.Write("https://ironsoftware.com");
            // Save as PNG image
            AnyBitmap qrImage = qrcode.Save();
            qrImage.SaveAs("website-qr.png");
        }
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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.

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.

LevelData RecoveryBest 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;
// Configure with high error correction level
var options = new QrOptions(QrErrorCorrectionLevel.High, 20);
// Generate QR code with options
var qrcode = QrWriter.Write("Product-12345", options);
AnyBitmap qrImage = qrcode.Save();
qrImage.SaveAs("product-qr.png");
using IronQr;
// Configure with high error correction level
var options = new QrOptions(QrErrorCorrectionLevel.High, 20);
// Generate QR code with options
var qrcode = QrWriter.Write("Product-12345", options);
AnyBitmap qrImage = qrcode.Save();
qrImage.SaveAs("product-qr.png");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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.

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:

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") }
};
var 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") }
};
var qrcode = QrWriter.Write("https://yourcompany.com");
AnyBitmap qrImage = qrcode.Save(styleOptions);
qrImage.SaveAs("branded-qr.png");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Styled QR Code

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

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's a HomeController class implementation:

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");
        }
    }
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

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

How Do You Encode Japanese Unicode Text?

IronQR supports encoding Japanese Unicode text through Kanji mode, which efficiently encodes Japanese unicode text using fewer data segments than standard encoding:

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");
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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 operation or configuration of data segments manually.

How Do You Read QR Codes with Machine Learning?

IronQR distinguishes itself through its machine learning-powered QR reader. The ML model achieves 99.99% accuracy even reading QR codes from angles or partially obscured images:

using IronQr;
using IronSoftware.Drawing;
// Load image containing QR code
var 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
var 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}");
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$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

This capability makes IronQR ideal for document processing and inventory management.

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.

Conclusion

IronQR provides a complete solution for all requirements QR code generator needs 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 .NET open source library alternative or a robust system with optional advanced features, IronQR's cross-platform architecture ensures reliable operation.

Ready to implement QR codes in your project? Start your free trial or explore licensing options to unlock IronQR's full potential. Visit the API documentation for additional code examples.

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 seamlessly 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