How to Set QR Code Error Correction Levels
Take control of performance. Adjust error correction settings to create faster, more durable QR codes that can withstand damage and still scan reliably.
Error correction is what separates a QR code that falls apart from one that keeps working. When a printed label gets scratched, a sticker peels, or a poster fades in the sun, error correction determines whether the code still scans. IronQR allows developers to choose exactly how much resilience a QR code carries, from lightweight codes optimized for clean digital displays to heavy-duty codes built to survive warehouses and factory floors.
This guide demonstrates how to configure error correction levels using the IronQR library, balancing data density against damage tolerance for any use case. Developers new to generating QR codes should start with the Create QR Code as Image guide first.
Quickstart: Set QR Code Error Correction
Configure the error correction level via QrOptions and generate a resilient QR code.
-
Install IronQR with NuGet Package Manager
PM > Install-Package IronQR -
Copy and run this code snippet.
var options = new QrOptions(QrErrorCorrectionLevel.Medium); var qrCode = QrWriter.Write("https://example.com", options); qrCode.Save().SaveAs("qr-medium.png"); -
Deploy to test on your live environment
Start using IronQR in your project today with a free trial
Minimal Workflow (5 steps)
- Download the IronQR C# library to generate QR codes with error correction
- Create a
QrOptionsobject with a chosenErrorCorrectionLevel - Generate the QR code using
QrWriter.Write()with those options - Save the QR code as a bitmap with
Save() - Export the bitmap to an image file with
SaveAs()
Understanding Error Correction Levels
QR codes use Reed-Solomon error correction to remain scannable even when partially damaged or obscured. The QrErrorCorrectionLevel enum in IronQR provides four levels, each trading data capacity for increased resilience:
| Level | Recovery Capacity | Best For |
|---|---|---|
QrErrorCorrectionLevel.Low |
~7% damage | Digital screens, controlled environments |
QrErrorCorrectionLevel.Medium |
~15% damage | General-purpose use, moderate durability |
QrErrorCorrectionLevel.High |
~25% damage | Printed materials, outdoor signage |
QrErrorCorrectionLevel.Highest |
~30% damage | Industrial labels, harsh conditions |
Higher error correction adds more redundancy modules, which increases the QR code's visual density. This also affects the size of the generated image, so developers may need to adjust dimensions accordingly. The lowest level that meets durability requirements keeps the code compact and fast to scan.
Setting Error Correction Level
To set the error correction level, pass the desired QrErrorCorrectionLevel value to the QrOptions constructor. Then pass these options to QrWriter.Write() when generating the QR code.
In this example, the error correction is set to Medium, which recovers up to 15% of damaged data while keeping the code compact.
:path=/static-assets/qr/content-code-examples/how-to/error-correction-qr-code.cs
using IronQr;
using IronSoftware.Drawing;
QrOptions options = new QrOptions(QrErrorCorrectionLevel.Medium);
// Create QR code
QrCode qr = QrWriter.Write("1234", options);
// Save QR code as a bitmap
AnyBitmap qrImage = qr.Save();
// Save QR code bitmap as file
qrImage.SaveAs("qrMedium.png");
Imports IronQr
Imports IronSoftware.Drawing
Dim options As New QrOptions(QrErrorCorrectionLevel.Medium)
' Create QR code
Dim qr As QrCode = QrWriter.Write("1234", options)
' Save QR code as a bitmap
Dim qrImage As AnyBitmap = qr.Save()
' Save QR code bitmap as file
qrImage.SaveAs("qrMedium.png")
Output
Comparing Error Correction Levels
Each level produces a visually different QR code. Lower levels generate simpler patterns that scan faster, while higher levels create denser patterns that survive more damage. Here's how to generate the same data at each level for comparison:
:path=/static-assets/qr/content-code-examples/how-to/error-correction-qr-code-compare.cs
using IronQr;
using IronSoftware.Drawing;
string data = "https://ironsoftware.com";
// Low - ~7% recovery, smallest code
QrCode qrLow = QrWriter.Write(data, new QrOptions(QrErrorCorrectionLevel.Low));
qrLow.Save().SaveAs("qrLow.png");
// Medium - ~15% recovery, balanced
QrCode qrMedium = QrWriter.Write(data, new QrOptions(QrErrorCorrectionLevel.Medium));
qrMedium.Save().SaveAs("qrMedium.png");
// High - ~25% recovery, durable
QrCode qrHigh = QrWriter.Write(data, new QrOptions(QrErrorCorrectionLevel.High));
qrHigh.Save().SaveAs("qrHigh.png");
// Highest - ~30% recovery, maximum resilience
QrCode qrHighest = QrWriter.Write(data, new QrOptions(QrErrorCorrectionLevel.Highest));
qrHighest.Save().SaveAs("qrHighest.png");
Imports IronQr
Imports IronSoftware.Drawing
Dim data As String = "https://ironsoftware.com"
' Low - ~7% recovery, smallest code
Dim qrLow As QrCode = QrWriter.Write(data, New QrOptions(QrErrorCorrectionLevel.Low))
qrLow.Save().SaveAs("qrLow.png")
' Medium - ~15% recovery, balanced
Dim qrMedium As QrCode = QrWriter.Write(data, New QrOptions(QrErrorCorrectionLevel.Medium))
qrMedium.Save().SaveAs("qrMedium.png")
' High - ~25% recovery, durable
Dim qrHigh As QrCode = QrWriter.Write(data, New QrOptions(QrErrorCorrectionLevel.High))
qrHigh.Save().SaveAs("qrHigh.png")
' Highest - ~30% recovery, maximum resilience
Dim qrHighest As QrCode = QrWriter.Write(data, New QrOptions(QrErrorCorrectionLevel.Highest))
qrHighest.Save().SaveAs("qrHighest.png")
Output
Low (~7% Recovery)
Medium (~15% Recovery)
High (~25% Recovery)
Highest (~30% Recovery)
Choosing the Right Level for the Use Case
The right error correction level depends on where the QR code will live and what it needs to survive:
| Use Case | Level | Why | Related Guide |
|---|---|---|---|
| Digital displays and websites | QrErrorCorrectionLevel.Low |
Screen is clean, lighting is controlled, no physical wear. Keeps the code simple and quick to scan. | Create QR Code as Image |
| Business cards, flyers, and indoor signage | QrErrorCorrectionLevel.Medium |
Light handling and minor creasing won't affect scanning. Pair with proper margins for best results. | Add Margins to QR Code |
| Product packaging and outdoor posters | QrErrorCorrectionLevel.High |
Materials face rain, UV exposure, and rough handling during shipping. Scale up size for distance scanning. | Resize QR Code |
| Warehouse labels, factory floors, and industrial tags | QrErrorCorrectionLevel.Highest |
Harsh environments where codes get scratched, stained, or partially covered. Maximum redundancy keeps them working. | Read QR Codes from Image |
For more advanced QR code generation patterns, explore the C# QR Code Generator tutorial and the full IronQR feature set.

