How to Read QR Code Values in C#
Extract decoded text from any QR code image instantly. Get the raw string value ready to display, store, or process in your application.
Reading a QR code's value is the first step in any scanning workflow. A payment terminal needs the transaction ID embedded in a QR code. A warehouse system needs the product reference on a label. A ticket validator needs the booking code printed on an event pass. IronQR makes this straightforward: load the image, pass it to QrReader, and read the decoded string directly from the result.
This guide demonstrates how to extract QR code values from images using the IronQR library. Developers who have not yet generated a QR code should start with the Create QR Code as Image guide first.
Quickstart: Read a QR Code Value
Load an image, scan it with QrReader, and extract the decoded string.
-
Install IronQR with NuGet Package Manager
PM > Install-Package IronQR -
Copy and run this code snippet.
var input = new QrImageInput("qr-code.png"); var results = new QrReader().Read(input); Console.WriteLine(results.First().Value); -
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 read QR code values
- Load the image and wrap it in a
QrImageInput - Create a
QrReaderinstance and callReadwith the input - Access the decoded string through
QrResult.Value - Guard with
results.Any()before accessing.First()
How Do I Read a QR Code Value from an Image?
To extract the value embedded in a QR code, load the image into a QrImageInput, pass it to QrReader.Read(), and access the Value property on the returned QrResult. The method returns a collection, one result per QR code found in the image.
Input
The QR code below encodes https://ironsoftware.com and will be scanned to extract its value.
:path=/static-assets/qr/content-code-examples/how-to/read-qr-code-value.cs
using IronQr;
using System.Drawing;
// Import image
var inputImage = Image.FromFile("sample.jpg");
// Load the asset into QrImageInput
QrImageInput imageInput = new QrImageInput(inputImage);
// Create a QR Reader object
QrReader reader = new QrReader();
// Read the input and get all embedded QR codes
IEnumerable<QrResult> results = reader.Read(imageInput);
// Display the value of the first QR code found
Console.WriteLine($"QR code value is {results.First().Value}");
Imports IronQr
Imports System.Drawing
Imports System.Linq
' Import image
Dim inputImage As Image = Image.FromFile("sample.jpg")
' Load the asset into QrImageInput
Dim imageInput As New QrImageInput(inputImage)
' Create a QR Reader object
Dim reader As New QrReader()
' Read the input and get all embedded QR codes
Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput)
' Display the value of the first QR code found
Console.WriteLine($"QR code value is {results.First().Value}")
The Value property returns the raw decoded string exactly as it was encoded: a URL, a number, free text, or any other data. The Read() method always returns an IEnumerable<QrResult>, even when only one QR code is present. If the image contains multiple QR codes, iterate with foreach (var result in results) to process each one. Guard with results.Any() before calling .First() to handle images where no QR code is found.
Output
How Do I Read All QR Code Properties?
Each QrResult exposes three properties that together give the full picture of what was scanned and where it was found in the image. Using the same input QR code from above:
:path=/static-assets/qr/content-code-examples/how-to/read-qr-code-value-properties.cs
using IronQr;
using IronSoftware.Drawing;
AnyBitmap inputImage = AnyBitmap.FromFile("sample.jpg");
QrImageInput imageInput = new QrImageInput(inputImage);
QrReader reader = new QrReader();
IEnumerable<QrResult> results = reader.Read(imageInput);
QrResult result = results.First();
// Decoded text content of the QR code
Console.WriteLine($"Value: {result.Value}");
// Parsed URL — populated when Value is a valid URL, null otherwise
Console.WriteLine($"Url: {result.Url}");
// Corner coordinates of the QR code in the image [TL, TR, BL, BR]
string[] labels = { "Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right" };
for (int i = 0; i < result.Points.Length; i++)
{
Console.WriteLine($"{labels[i]}: ({result.Points[i].X}, {result.Points[i].Y})");
}
Imports IronQr
Imports IronSoftware.Drawing
Dim inputImage As AnyBitmap = AnyBitmap.FromFile("sample.jpg")
Dim imageInput As New QrImageInput(inputImage)
Dim reader As New QrReader()
Dim results As IEnumerable(Of QrResult) = reader.Read(imageInput)
Dim result As QrResult = results.First()
' Decoded text content of the QR code
Console.WriteLine($"Value: {result.Value}")
' Parsed URL — populated when Value is a valid URL, Nothing otherwise
Console.WriteLine($"Url: {result.Url}")
' Corner coordinates of the QR code in the image [TL, TR, BL, BR]
Dim labels As String() = {"Top-Left", "Top-Right", "Bottom-Left", "Bottom-Right"}
For i As Integer = 0 To result.Points.Length - 1
Console.WriteLine($"{labels(i)}: ({result.Points(i).X}, {result.Points(i).Y})")
Next i
Output
What Properties Does QrResult Expose?
QrResult exposes the following properties after a successful scan:
| Property | Type | Description |
|---|---|---|
Value |
string |
The raw decoded string exactly as encoded. Can hold a URL, plain text, numeric ID, JSON, or any other data. This is the primary property for most applications. |
Url |
Uri |
A parsed Uri object populated when Value is a valid absolute URL. Use it to open links, validate domains, or extract URL components. Returns null if the value is not a URL. |
Points |
PointF[] |
Four corner coordinates marking the QR code's position in the source image, ordered [Top-Left, Top-Right, Bottom-Left, Bottom-Right]. Use it to draw bounding boxes, crop regions, or calculate scan area. |
What Are Common Use Cases for QR Code Value Reading?
- Payment terminals: Decode a transaction URL or reference ID from a customer's QR code to initiate a payment flow.
- Ticket validation: Extract a booking reference from a printed or on-screen QR code to verify event entry.
- Inventory management: Read product serial numbers or SKUs from warehouse labels to update stock records.
- Document verification: Pull a record ID or hash from a QR code stamped on a legal or government document.
- User authentication: Decode a one-time token from a QR code to complete a two-factor login step.
For more QR code reading patterns, explore the Read QR Codes from Image guide and the full IronQR feature set.

