DEV Community

IronSoftware
IronSoftware

Posted on

ZXing.NET vs IronBarcode: Pick a .NET Barcode Library

ZXing.NET vs IronBarcode: Picking a Barcode Library for .NET

Choosing a barcode library for a .NET project usually comes down to a few questions: which formats do you need, how clean are your input images, and how much budget do you have. We looked at two options that come up constantly in .NET barcode discussions: ZXing.NET and IronBarcode.

Full disclosure: we're the team behind IronBarcode, one of the two libraries here. We've tried to keep this fair and flag where ZXing.NET is the better pick, so judge the code and the tradeoffs yourself.

Here's what we found: both are real, working choices, and the right one depends on your situation more than on any feature checklist. ZXing.NET is free, open-source, and mature. IronBarcode trades that open-source freedom for a higher-level .NET API and built-in handling of messy real-world images. Let's look at the code.

ZXing.NET

ZXing.NET is the .NET port of the Java ZXing library ("Zebra Crossing"). It's open-source under Apache 2.0, which means it's free to use, modify, and ship commercially with attribution. It decodes and generates a wide list of 1D and 2D formats: QR Code, Data Matrix, Aztec, PDF 417, Code 128, Code 93, UPC-A/E, EAN-8/13, Codabar, and more. It has been around for years and has a large community, so most problems you hit already have an answer somewhere.

You install it from NuGet:

Install-Package ZXing.Net
Enter fullscreen mode Exit fullscreen mode

Generating a code

To produce a QR code you set up a writer, generate pixel data, and turn that into an image yourself. Here's a condensed version:

using ZXing;
using ZXing.QrCode;
using ZXing.Common;

var qrWriter = new BarcodeWriterPixelData
{
    Format = BarcodeFormat.QR_CODE,
    Options = new EncodingOptions { Height = 250, Width = 250, Margin = 0 }
};

PixelData pixelData = qrWriter.Write("hello world");
// pixelData.Pixels is a BGRA byte array you then copy into a Bitmap and save.
Enter fullscreen mode Exit fullscreen mode

Reading a code

Reading is similar: load a bitmap, hand it to the reader, and inspect the result.

using ZXing;
using System;
using System.Drawing;

var barcodeReader = new BarcodeReader();
var sourceBitmap = (Bitmap)Image.FromFile("sample-barcode-image.png");
Result decodeResult = barcodeReader.Decode(sourceBitmap);

if (decodeResult != null)
{
    Console.WriteLine(decodeResult.BarcodeFormat + ": " + decodeResult.Text);
}
Enter fullscreen mode Exit fullscreen mode

That prints the format and decoded text, or skips the block when nothing decodes. The tradeoff here is that you're closer to the metal. On a clean, machine-generated image this works well and costs nothing. ZXing.NET also leans on System.Drawing, so on .NET Core and later you often add a bindings package for image handling, and the decoder is sensitive to skew, rotation, and noise.

✅ If your inputs are clean barcodes and your budget is zero, ZXing.NET is often the right call, and for plenty of projects it's the one we'd reach for too. The project lives at github.com/micjahn/ZXing.Net.

IronBarcode

IronBarcode is a commercial .NET library with a higher-level API for reading and writing barcodes. It targets .NET Standard and Core 2.0+ across Windows, Linux, macOS, and Azure, and supports the same broad set of 1D/2D formats plus styled QR codes with logos and color. The difference you pay for is the layer on top: a simpler API and built-in correction for imperfect images.

Installation is a single NuGet package, and you can run the snippets below in about five minutes:

Install-Package BarCode
Enter fullscreen mode Exit fullscreen mode

Generating a code

A barcode or QR code is one statement to create, and saving to common formats is built in:

using IronBarCode;

// Code 128 barcode
BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeEncoding.Code128)
    .SaveAsPng("MyBarCode.png");

// QR code with a chosen error-correction level
QRCodeWriter.CreateQrCode("hello world", 500, QRCodeWriter.QrErrorCorrectionLevel.Medium)
    .SaveAsPng("MyQR.png");
Enter fullscreen mode Exit fullscreen mode

Reading a code

Reading a clean barcode is one call. Read returns a collection of BarcodeResult, so take the first match and read its .Value:

using IronBarCode;
using System;
using System.Linq;

var firstResult = BarcodeReader.Read("GetStarted.png").FirstOrDefault();
if (firstResult != null)
{
    Console.WriteLine("Read value: " + firstResult.Value);
}
Enter fullscreen mode Exit fullscreen mode

The part that justifies the cost is reading from imperfect sources: skewed, rotated, or noisy images such as phone photos and scans. You can pass correction settings and a specific format to steer the reader:

using IronBarCode;
using System;

var photoResults = BarcodeReader.Read(
    "Photo.png",
    new BarcodeReaderOptions
    {
        ExpectBarcodeTypes = BarcodeEncoding.Code128,
        Speed = ReadingSpeed.Detailed
    });

foreach (var barcode in photoResults)
{
    Console.WriteLine(barcode.Value);
}
Enter fullscreen mode Exit fullscreen mode

IronBarcode also reads barcodes directly from PDF documents and multi-frame TIFFs without you splitting pages first, and it can stamp generated barcodes onto existing PDFs. The tradeoff is honest: it's a paid, closed-source library rather than free and open-source. If your images are predictable and clean, that preprocessing buys you little. If you're pulling barcodes off real-world scans and want to stay inside a single .NET API, it removes work you'd otherwise write yourself.

How they compare

Factor ZXing.NET IronBarcode
Read / write ✅ Both ✅ Both
Symbologies QR, Data Matrix, Aztec, PDF 417, Code 128/93, UPC, EAN, Codabar, more Same broad 1D and 2D set, plus styled QR
API style Lower-level, you assemble images High-level .NET, one call to generate or read
Image preprocessing You handle skew/noise yourself Built-in rotation and noise correction
PDF / multi-frame TIFF Manual extraction Read directly
Image stack Often needs a System.Drawing bindings package Self-contained
.NET targets .NET Standard / Core / Framework (+ binding) .NET Standard / Core 2.0+, Windows, Linux, macOS, Azure
License Apache 2.0, free, open-source Commercial, paid, closed-source
Maintenance Large community, tracks Java upstream Commercial support and docs

A few honest takeaways. On price and openness, ZXing.NET wins outright: it's free, the source is right there, and it's backed by years of community use. IronBarcode's advantage is narrower and specific: a single-package install, a simpler API, and correction for messy inputs. For a use case with clean inputs and no budget, ZXing.NET might actually be the better choice, and we'd say so plainly.

So which one?

There's no single winner here, and we'd be skeptical of any comparison that declared one.

  • ✅ Pick ZXing.NET if you want free, open-source code, a mature community, and your barcode images are clean and machine-generated.
  • ✅ Pick IronBarcode if you're staying inside .NET, your inputs are noisy scans or photos that need correction, and you'd trade a license fee for a single install and a higher-level API. The IronBarcode reading and writing tutorial shows the PDF and correction paths end to end.

The fairest test is your own data. Run the same set of representative images through both and compare what decodes and how long it takes.

Which barcode library are you running in production, and what made you pick it? We'd genuinely like to hear which won on your images in the comments.

If you want to put IronBarcode against ZXing.NET on your own files first, there's a free trial.

ZXing and ZXing.NET are trademarks of their respective owners; this comparison reflects publicly available information at the time of writing.

Top comments (0)