Read Code 39 Barcodes in C# Quickly and Easily
IronBarcode simplifies reading both standard and extended Code 39 barcodes in C# by using the BarcodeReaderOptions class with BarcodeEncoding.Code39 specified, and enabling UseCode39ExtendedMode for full ASCII character support when needed.
Code 39 is a versatile barcode format widely used in inventory, logistics, and industrial applications. A Code 39 barcode can vary in length, making it flexible for different use cases.
The original Standard Code 39 encodes uppercase letters (A-Z), digits (0-9), and several special characters (space, -, $, +, %, and .). This works well for basic IDs, but modern applications often require encoding all 128 ASCII characters. The Code 39 Extended specification addresses this need.
This guide demonstrates how to read both standard and extended Code 39 variations with IronBarcode. Whether you're building inventory management systems, tracking shipments, or processing industrial barcodes, IronBarcode provides reliable Code 39 reading capabilities. For a complete overview of barcode reading capabilities, check out our comprehensive barcode quickstart guide.
Quickstart: Read Code 39 Barcodes in C#
Use IronBarcode's BarcodeReader to decode a Code 39 barcode from an image in one line of code. Get started immediately - specify the encoding type, pass your image, and read the result.
-
1Install IronBarcode with NuGet Package Manager
-
2Copy and run this code snippet.
IronBarCode.BarcodeReader.Read("code39.png", new IronBarCode.BarcodeReaderOptions { ExpectBarcodeTypes = IronBarCode.BarcodeEncoding.Code39 }).First().ToString();C# -
3Deploy to test on your live environment
Start using IronBarcode in your project today with a free trial
How to Read Code 39 Barcodes in C#
- Download the IronBarcode C# library to read Code39 barcodes
- Initialize a new
BarcodeReaderOptions - Specify
BarcodeEncoding.Code39in the options - Read the Code 39 barcode with
Read - Verify the results and print them to the console
How Do I Read Standard Code 39 Barcodes?
Reading a Code 39 barcode with IronBarcode is straightforward. First, initialize a new BarcodeReaderOptions and specify the barcode type as BarcodeEncoding.Code39. This optimizes the reader by telling it exactly what barcode format to look for.
Next, read the barcodes using the Read method, passing the barcode image and options as parameters. Then iterate over the results collection and print each barcode's string value to the console. For more advanced configurations, explore our detailed guide on barcode reader settings.
What Does a Standard Code 39 Barcode Look Like?
This image contains a standard Code 39 barcode. Notice how the barcode displays its encoded value both as bars and as human-readable text below. This dual representation is typical of Code 39 barcodes in industrial and logistics applications.

What Code Do I Need to Read Standard Code 39?
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());
}Imports IronBarCode
Imports System
Dim options As New BarcodeReaderOptions() With {
.ExpectBarcodeTypes = BarcodeEncoding.Code39
}
' Read barcode(s) from the image file using the specified options
Dim results = BarcodeReader.Read("code39.png", options)
' Loop through each BarcodeResult found in the image
For Each result In results
' Print the decoded string value of the standard Code 39 barcode
Console.WriteLine(result.ToString())
NextSpecifying the expected barcode type significantly improves reading performance. IronBarcode doesn't waste time looking for other barcode formats, which especially benefits batch processing of large image sets. Learn more about optimizing barcode reading performance with our reading speed options guide.
What Output Should I Expect?

The console output shows the successfully decoded value "ABC-1234" from our Code 39 barcode. The exit code 0 confirms successful execution without errors. In production applications, implement proper error handling for cases where barcodes might not be recognized. Check out our troubleshooting guide for unrecognized barcodes if you encounter issues.
How Do I Read Extended Code 39 Barcodes?
Reading an extended Code 39 barcode follows a similar process to standard Code 39. The key difference is setting the UseCode39ExtendedMode property to true.
This setting instructs IronBarcode to interpret special character pairs (e.g., +T, %O) and decode them into their full-ASCII equivalents (e.g., t, !). Extended Code 39 uses two-character sequences to represent characters outside the standard set. This makes the barcode slightly longer but enables encoding of lowercase letters, additional punctuation, and control characters.
When Should I Use Extended Code 39?
Extended Code 39 is ideal when your application needs to encode:
- Mixed case text (uppercase and lowercase letters)
- Special characters like @, #, &, !, ?
- Control characters for data transmission
- Full ASCII character set support
Common applications include healthcare systems, document tracking, and advanced inventory management requiring rich data encoding.
What Does an Extended Code 39 Barcode Look Like?
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.

What Code Do I Need for Extended Code 39?
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());
}Imports IronBarCode
Imports System
Dim options As New BarcodeReaderOptions() With {
.UseCode39ExtendedMode = True,
.ExpectBarcodeTypes = BarcodeEncoding.Code39
}
' Read barcode(s) from the extended code 39 image
Dim results = BarcodeReader.Read("code39extended.png", options)
' Loop through each BarcodeResult found in the image
For Each result In results
' Print the fully decoded ASCII string (e.g., "Test-Data!")
Console.WriteLine(result.ToString())
NextWhat Output Should I Expect from Extended Mode?

Advanced Code 39 Reading Techniques
Handling Multiple Barcodes
IronBarcode automatically detects and reads multiple Code 39 barcodes in a single image. The Read method returns a collection of results, allowing you to process each barcode individually. For applications dealing with sheets of barcodes or complex documents, see our guide on reading multiple barcodes.
Dealing with Poor Quality Images
Code 39 barcodes sometimes appear in less-than-ideal conditions - faded prints, skewed angles, or low-resolution scans. IronBarcode includes powerful image correction filters that can significantly improve reading accuracy:
BarcodeReaderOptions options = new BarcodeReaderOptions()
{
ExpectBarcodeTypes = BarcodeEncoding.Code39,
UseCode39ExtendedMode = true,
// Apply image correction filters
ImageFilters = new ImageFilterCollection() {
new SharpenFilter(),
new ContrastFilter(),
new BrightnessFilter()
}
};Imports System
Dim options As New BarcodeReaderOptions() With {
.ExpectBarcodeTypes = BarcodeEncoding.Code39,
.UseCode39ExtendedMode = True,
' Apply image correction filters
.ImageFilters = New ImageFilterCollection() From {
New SharpenFilter(),
New ContrastFilter(),
New BrightnessFilter()
}
}Performance Optimization
For high-volume barcode reading applications, consider these optimization strategies:
- Specify exact barcode types - Always set
ExpectBarcodeTypesto avoid unnecessary scanning - Use appropriate reading speeds - Balance speed and accuracy based on your needs
- Process images in parallel - Utilize multi-threading for batch processing
- Pre-process images - Apply corrections only when necessary to maintain performance
Summary
IronBarcode simplifies Code 39 barcode reading in C#, whether working with standard or extended formats. The key steps are:
With these fundamentals, you're ready to integrate Code 39 barcode reading into your .NET applications. For complete API documentation and additional barcode formats, visit our comprehensive API reference. For a hands-on example specific to Code 39, check out our dedicated Code 39 tutorial.
Frequently Asked Questions
How can I read a standard Code 39 barcode using C#?
To read a standard Code 39 barcode in C#, use the IronBarcode library. Initialize `BarcodeReaderOptions`, specify `BarcodeEncoding.Code39`, and use the `Read` method with the barcode image.
What is the difference between Standard and Extended Code 39 barcodes?
Standard Code 39 encodes uppercase letters, digits, and some special characters. Extended Code 39 supports the full ASCII set by using character pairs like +T or %O to represent characters outside the standard set.
What are common use cases for Code 39 barcodes?
Code 39 barcodes are commonly used in inventory, logistics, and industrial applications due to their variable length and flexibility in encoding basic IDs.
How does IronBarcode handle poor quality barcode images?
IronBarcode includes image correction filters, such as sharpening and contrast adjustment, to improve reading accuracy for poor quality barcode images.
What do you need to do to read Extended Code 39 barcodes in C#?
To read Extended Code 39 barcodes, enable `UseCode39ExtendedMode` in IronBarcode's `BarcodeReaderOptions` to allow decoding of the full ASCII character set.
How can I optimize barcode reading performance in high-volume applications?
For high-volume applications, set `ExpectBarcodeTypes` to limit scanning to Code 39, use appropriate reading speeds, and process images in parallel for improved performance.
Can IronBarcode read multiple barcodes from a single image?
Yes, IronBarcode can detect and read multiple Code 39 barcodes from a single image using the `Read` method, which returns a collection of results.
What output should I expect when reading an Extended Code 39 barcode?
When reading an Extended Code 39 barcode, expect the console to display the fully decoded ASCII string, which may include lowercase letters and special characters.
Why might I need to use Extended Code 39 barcodes?
Extended Code 39 is useful when encoding mixed case text, special characters, or control characters, making it ideal for applications requiring detailed data encoding such as healthcare or document tracking.
What is the role of `BarcodeReaderOptions` in IronBarcode?
`BarcodeReaderOptions` allows you to specify settings like barcode type and extended mode, optimizing the reading process by configuring expected input and enabling additional features.

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.