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.
Get started with IronBarcode
Quickstart: Read Code 39 Barcodes in C#
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?
```cs :title=Reading Standard Code 39 Barcodes / :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()); }
Specifying 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](https://ironsoftware.com/csharp/barcode/how-to/reading-speed-options/).
### What Output Should I Expect?
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/read-code39-barcodes/standard-output.webp" alt="Visual Studio console showing Code 39 barcode reading output with decoded value ABC-1234 and exit code 0" barcode class="img-responsive add-shadow">
</div>
</div>
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](https://ironsoftware.com/csharp/barcode/troubleshooting/barcode-not-recognized/) if you encounter issues.
<hr>
## 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.
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/read-code39-barcodes/code39extended.webp" alt="Extended Code 39 barcode showing encoded data with 'Test-Data!' displayed as the decoded output below the bars" barcode class="img-responsive add-shadow">
</div>
</div>
### What Code Do I Need for Extended Code 39?
```cs
:path=/static-assets/barcode/content-code-examples/how-to/read-extended-code39-barcode.csWhat 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()
}
};BarcodeReaderOptions options = new BarcodeReaderOptions()
{
ExpectBarcodeTypes = BarcodeEncoding.Code39,
UseCode39ExtendedMode = true,
// Apply image correction filters
ImageFilters = new ImageFilterCollection() {
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:
- Create a
BarcodeReaderOptionsinstance - Set
ExpectBarcodeTypestoBarcodeEncoding.Code39 - Enable
UseCode39ExtendedModefor full ASCII support when needed - Use the
Readmethod to process your images
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
What is Code 39 and what are its common uses?
Code 39 is a versatile barcode format widely used in inventory, logistics, and industrial applications. It can vary in length, making it flexible for different use cases. Standard Code 39 encodes uppercase letters (A-Z), digits (0-9), and several special characters, while Code 39 Extended can encode all 128 ASCII characters. IronBarcode provides reliable capabilities for reading both standard and extended Code 39 variations.
How do I read a standard Code 39 barcode in C#?
To read a Code 39 barcode with IronBarcode, first initialize a new BarcodeReaderOptions and specify the barcode type as BarcodeEncoding.Code39. Then use the Read method, passing the barcode image and options as parameters. Finally, iterate over the results collection to access each barcode's string value.
What characters can standard Code 39 encode?
Standard Code 39 encodes uppercase letters (A-Z), digits (0-9), and several special characters including space, hyphen (-), dollar sign ($), plus sign (+), percent (%), and period (.). For encoding all 128 ASCII characters, you'll need to use Code 39 Extended mode, which IronBarcode supports through the UseCode39ExtendedMode option.
What's the difference between standard and extended Code 39?
Standard Code 39 is limited to uppercase letters, numbers, and a few special characters, which works well for basic IDs. Code 39 Extended addresses the need for modern applications to encode all 128 ASCII characters. IronBarcode simplifies reading both variations by enabling UseCode39ExtendedMode in the BarcodeReaderOptions class for full ASCII character support.
Can Code 39 barcodes include human-readable text?
Yes, Code 39 barcodes typically display their encoded value both as bars and as human-readable text below the barcode. This dual representation is common in industrial and logistics applications, making it easier for operators to verify barcode contents. IronBarcode can read the barcode data regardless of whether the human-readable text is present.






