KA.Barcode for .NET Suite
How to Generate Code 39 in C# Application
How to Generate Linear Code 39 Barcode Images in C#, ASP.NET, WinForms, Crystal & RDLC

C# Code 39 Generator
How to create, generate Code 39 barcodes with checksum using c# class with free example. no font.









  • Automatically add checksum digit for Code 39 according to ISO+IEC+16388 specifications
  • Easily integrate into .NET applications to generate Code 39 using Visual C#.NET class library
  • Create linear Code 39 barcode in ASP.NET, WinForms, Crystal Reports and RDLC Reports, etc
  • Support Code 128, EAN-13, EAN-128, UPC-A, UPC-E, Data Matrix and many other barcode types
  • Make scannable 1D Code 39 barcode images with high resolution that can be printed by almost all printers
  • Provide detailed user guide to help customers generate Code 39 barcode images in C#.NET
C# Code 39 Barcode Generator Overview
KA.Barcode Generator for .NET Suite is an outstanding barcode encoder component SDK which helps developers easily add barcoding features into .NET. This encoder component supports Code 39 barcode generation in C#.NET as well as other 1D and 2D barcode symbologies. And you can also customize the generated barcode images.

What Is A Code 39 Barcode
Code 39, also named as 3 of 9 Code, USD-3, Alpha39, Code 3/9, Type 39, USS Code39, is a self-checking linear barcode which encodes alphanumeric data. Code 39 is widely used in non-retail industries.

Code 39 in ASP.NET web apps

This barcode control dll for .NET allows developers to create and stream Code 39 linear barcode images in ASP.NET web applications. You can add this control to Toolbox and drag it to ASP.NET web page for Code 39 generation. Or you can add it to reference and create Code 39 through C# Class Library. Still, you can create Code 39 image in Microsoft IIS through URL without using Visual Studio. See:
How to print barcode in Visual C# with ASP.NET framework web control?
How to generate barcode in ASP.NET Core web app?
How to create barcodes in ASP.NET Core MVC web app?

Code 39 in WinForms, WPF Windows apps

For users who want to create Code 39 in .NET Windows Forms applications, they can turn to this barcode generator SDK. What provided are two methods for Code 39 creation: barcode control drag-and-drop from Toolbox or Visual C# class library & console applications after adding reference. Please refer to
How to create barcode in .NET WinForms with Visual C#
How to create barcode in WPF .NET Core apps?

Code 39 Data Encoding using C#

Standard data mode

Code 39 barcode with standard data mode supports 43 characters, including
  • Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

  • Uppercase letters: A - Z

  • Special characters: - (Dash), $ (Dollar), % (Percentage), (Space), . (Point), / (Slash), + (Plus)

  • Start and Stop characters
The following C# source code shows how to quickly create a Code 39 barcode with standard data mode using C#.
  • Create a new BarCode object

  • Set the barcode object barcode type as "KeepAutomation.Barcode.Symbology.Code39"

  • Set property CodeToEncode with Code 39 data

  • Create and output Code 39 barcode to an image file in C#
            BarCode code39 = new BarCode();
            code39.Symbology = KeepAutomation.Barcode.Symbology.Code39;
            code39.CodeToEncode = "ABC-123";
            code39.generateBarcodeToImageFile("C://Projects//Test-Output//KeepAutomation.com//code39-standard.png");




Full ASCII data mode

Code 39 barcode with full ASCII data mode encodes:
  • All 128 ASCII characters
Here we will generate a new Code 39 barcode image with full ASCII data encoded in C# code.
  • Set the barcode object barcode type as "KeepAutomation.Barcode.Symbology.Code39ex" for Code 39 full ASCII data encoding in C#
            BarCode code39 = new BarCode();
            code39.Symbology = KeepAutomation.Barcode.Symbology.Code39ex;
            code39.CodeToEncode = "ABC-abc-123";
            code39.generateBarcodeToImageFile("C://Projects//Test-Output//KeepAutomation.com//code39-full-ascii.png");




Code 39 check sum digit

Code 39 does not include a checksum or check digit by default. Some Code 39 application standards require enhanced data security, the modulo 43 (MOD43) check sum character may be used as a Code 39 check digit.
We will use and update the above C# demo source code to generate Code 39 barcode with standard mode data and apply a Code 39 check digit on it.
  • Set the barcode object property ChecksumEnabled to true. Now you will find a new Code 39 check sum character appended to the end of the Code 39 data.
            BarCode code39 = new BarCode();
            code39.Symbology = KeepAutomation.Barcode.Symbology.Code39;
            code39.CodeToEncode = "ABC-123";
            code39.ChecksumEnabled = true;
            code39.generateBarcodeToImageFile("C://Projects//Test-Output//KeepAutomation.com//code39-standard-check-digit.png");


You can also enable the check digit in generated Code 39 barcode, but hide the check digit in the Code 39 printed text label.

            code39.DisplayChecksum = false;




Start, stop characters

Code 39 barcode uses asterisk character (*) as Start and Stop characters, and it should not be part of the Code 39 barcode data.

By default, the Code 39 barcode text label will show the Start / Stop characters (*). You can also hide it in your C# program.
In your C# application source code, call property DisplayStartStop to false to hide the start/stop characters displayed in the printed Code 39 text label.

            BarCode code39 = new BarCode();
            code39.Symbology = KeepAutomation.Barcode.Symbology.Code39;
            code39.CodeToEncode = "ABC-123";
            code39.DisplayStartStop = false;
            code39.generateBarcodeToImageFile("C://Projects//Test-Output//KeepAutomation.com//code39-standard-hide-start-stop.png");




Code 39 minimum data length

There are no specified requirements for Code 39 barcode minimum and maximum data size.

Some barcode scanners will not scan code 39 for less than 4 characters by default.




Generate Barcode Image in Specified Width and Height
  • Set property AutoSizeAdjust to true

  • Set property DPI to be the same or higher as your printer's resolution

  • Set property BarcodeUnit to inch or cm

  • Set property BarCodeWidth and BarCodeHeight to your required image width and height
Code 39 Property Settings
How to Generate Code 39 in .NET Applications using C#
We have provided complete C# demo source code to customize the Code 39 barcode in .net projects. You can view the details here: Complete C# source code for each Code 39 property settings in .NET application