How to Read Code 39 Barcodes in C#

When it comes to inventory, logistics, and industrial applications, you need a reliable and widely compatible barcode. One of the most popular and versatile options is Code 39. A Code 39 barcode is a popular barcode format that can vary in length.

The original Standard Code 39 is capable of encoding uppercase letters (A-Z), digits (0-9), and a handful of special characters (like space, -, $, +, %, and .). This was great for basic IDs, but modern needs often require encoding all 128 ASCII characters. For this, the Code 39 Extended specification was created.

In this how-to, we'll show you how to easily read both the standard and extended variations of Code 39 with IronBarcode.

Get started with IronBarcode

Start using IronBarcode in your project today with a free trial.

First Step:
green arrow pointer



Reading Standard Code 39 Barcode

Reading a Code 39 barcode is straightforward with IronBarcode. We first initialize a new BarcodeReaderOptions and specify the barcode type, which is BarcodeEncoding.Code39. This step optimizes the reader by telling it exactly what kind of barcode to look for.

Afterwards, we read the barcodes using the Read method, passing the barcode image and the options variable as parameters. We then iterate over the results collection and print the string value of each barcode to the console.

Input Barcode Image

This image contains a standard Code 39 barcode.

Standard Code 39 barcode

Code

:path=/static-assets/barcode/content-code-examples/how-to/read-code39-barcode.cs
using IronBarCode;
using System;

BarcodeReaderOptions options = new BarcodeReaderOptions()
{
    // Tell the reader to only look for Code 39.
    ExpectBarcodeTypes = BarcodeEncoding.Code39
};

// Read barcode(s) from the image file using the specified options
var results = BarcodeReader.Read("code39.png", options);

// Loop through each BarcodeResult found in the image
foreach (var result in results)
{
    // Print the decoded string value of the standard Code 39 barcode
    Console.WriteLine(result.ToString());
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Output

Standard Code39 Output

Reading Extended Code 39 Barcode

Reading an extended Code 39 barcode is quite similar to its standard counterpart. The main difference is that we must set the UseCode39ExtendedMode property to true.

This setting instructs IronBarcode to interpret the special character pairs (e.g., +T, %O) and decode them into their proper full-ASCII equivalents (e.g., t, !).

Input Barcode Image

This image contains an extended Code 39 barcode. The value Test-Data! contains lowercase characters and an exclamation mark, which are only available in the full ASCII set and require extended mode.

Extended Code39

Code

:path=/static-assets/barcode/content-code-examples/how-to/read-extended-code39-barcode.cs
using IronBarCode;
using System;

BarcodeReaderOptions options = new BarcodeReaderOptions()
{
    // Enable extended Code 39 mode
    UseCode39ExtendedMode = true,

    // Specify that we are expecting Code 39 barcodes
    ExpectBarcodeTypes = BarcodeEncoding.Code39
};

// Read barcode(s) from the extended code 39 image
var results = BarcodeReader.Read("code39extended.png", options);

// Loop through each BarcodeResult found in the image
foreach (var result in results)
{
    // Print the fully decoded ASCII string (e.g., "Test-Data!")
    Console.WriteLine(result.ToString());
}
IRON VB CONVERTER ERROR developers@ironsoftware.com
$vbLabelText   $csharpLabel

Output

Extended Code39 Output

Tips The console output may not properly display all ASCII characters. In those scenarios, please pipe the output to a .txt file to verify the extracted result.

Frequently Asked Questions

What is Code 39 barcode?

Code 39 is a popular barcode format used in inventory, logistics, and industrial applications. It can encode uppercase letters, digits, and some special characters. There is also an extended version that supports all 128 ASCII characters.

How can I read Code 39 barcodes in C#?

You can read Code 39 barcodes in C# using the IronBarcode library. Initialize a BarcodeReaderOptions, specify BarcodeEncoding.Code39, and use the Read method to extract the barcode data.

What do I need to start reading Code 39 barcodes with IronBarcode?

To get started, download the IronBarcode C# library from NuGet. Then, initialize a BarcodeReaderOptions object and specify the barcode type as Code39.

What is the difference between Standard and Extended Code 39?

Standard Code 39 can encode uppercase letters, digits, and a few special characters, while Extended Code 39 supports the full set of 128 ASCII characters by using special character pairs.

How do I read an extended Code 39 barcode with IronBarcode?

To read an extended Code 39 barcode, set the UseCode39ExtendedMode property to true in IronBarcode. This allows the library to decode the full ASCII character set.

What is the role of BarcodeReaderOptions in IronBarcode?

BarcodeReaderOptions in IronBarcode allows you to specify the type of barcode you want to read, optimizing the reading process by focusing on the specified format.

Can IronBarcode read both standard and extended Code 39 barcodes?

Yes, IronBarcode can read both standard and extended Code 39 barcodes. For extended barcodes, ensure that the UseCode39ExtendedMode property is set to true.

Does IronBarcode support special characters in Code 39 barcodes?

Yes, IronBarcode supports special characters in Code 39 barcodes. The standard version supports a few special characters, while the extended version supports all ASCII characters.

What is required to decode the full ASCII set in Code 39 barcodes?

To decode the full ASCII set in Code 39 barcodes, you must use the extended version and set the UseCode39ExtendedMode property to true in IronBarcode.

Is IronBarcode capable of working with image files for barcode reading?

Yes, IronBarcode can read barcodes from image files. You pass the barcode image along with the BarcodeReaderOptions to the Read method to extract the data.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 1,932,297 | Version: 2025.11 just released