How to create 1D and Linear Barcodes
IronBarcode enables you to generate all major 1D barcode formats including Code 128, GS1-128, Code 39, Code 93, EAN-13, EAN-8, UPC-A, UPC-E, Intelligent Mail, MSI, Codabar, and DataBar using simple C# code with automatic validation and compliance checking. You can explore the complete list of supported barcode formats to find the right one for your needs.
Linear barcodes remain the industry standard for relaying information. They are fast, reliable, and work with almost any scanner. Since these barcodes don't require complex image processing, they excel in high-speed environments like retail checkout lines and conveyor belts.
The main challenge is selecting the correct format for your specific needs. You might need Code128’s high data density for shipping labels, EAN8’s compact size for small products, or IntelligentMail Barcode’s strict formatting for postal services. IronBarcode helps you generate all these formats efficiently and reliably. The library also supports various output data formats to integrate seamlessly with your existing systems.
This guide covers how to generate the most critical 1D formats and their common use cases with IronBarcode.
Quickstart: Create Your First 1D Barcode
Use IronBarcode's simple API to create a Code128 barcode from a string and save it as a JPEG image. Get started immediately—supply the data, choose the encoding and size, and write your image file.
-
Install IronBarcode with NuGet Package Manager
PM > Install-Package BarCode -
Copy and run this code snippet.
IronBarCode.BarcodeWriter.CreateBarcode("HELLO-WORLD-123", BarcodeEncoding.Code128, 250, 100).SaveAsJpeg("MyFirstBarcode.jpg"); -
Deploy to test on your live environment
Start using IronBarcode in your project today with a free trial
How to Create 1D and Linear Barcodes with IronBarcode
- Download the IronBarcode C# library to create barcodes
- Generate a barcode with a string value with
CreateBarcode - Specify the barcode type with
BarcodeEncoding - Save the barcode as an image or other format with
SaveAsJpeg
How Do I Create 1D and Linear Barcodes?
Linear one-dimensional barcodes use variable-width lines and spaces to store data horizontally. Two-dimensional barcodes like QR codes use a grid of squares to hold information in two dimensions. While two-dimensional codes accommodate more data, such as URLs or contact cards, one-dimensional barcodes are restricted to short alphanumeric strings.
This simplicity allows one-dimensional barcodes to scan more quickly. It makes them universally compatible with standard laser scanners, making them ideal for high-speed retail and logistics settings. When working with high-volume scanning applications, explore our reading speed options to optimize performance.
Let's explore the most supported formats and how to create them with IronBarcode.
How Do I Create Code-128 Barcodes?
Code 128 barcodes are commonly used for internal logistics and shipping labels. It supports the full 128-character ASCII range, making it highly efficient at compressing standard numbers and English text into small spaces. This makes Code 128 ideal for warehouse management systems and inventory tracking where space is limited but data density is crucial.
However, it doesn't natively support Unicode or non-Latin characters without additional extensions. It cannot handle complex characters from languages like Chinese or Arabic and would misinterpret the data, leading to incorrect output. For applications requiring Unicode support, see our guide on writing Unicode barcodes.
What Code Do I Need?
IronBarcode makes generating Code-128 straightforward: pass BarcodeEncoding.Code128 as the second parameter when calling the Create method, then export as an image. Learn more about creating barcode images with various formats and options.
:path=/static-assets/barcode/content-code-examples/how-to/create-code-128-barcode.cs
using IronBarCode;
// Specify Code 128 Format
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Code128);
// Add barcode value text below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save it as JPG
barcode.SaveAsJpeg("code128-sample.jpg");
Imports IronBarCode
' Specify Code 128 Format
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Code128)
' Add barcode value text below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save it as JPG
barcode.SaveAsJpeg("code128-sample.jpg")
What Does the Output Look Like?
How Do I Create GSI-128 Barcodes?
GS1-128 is an additional data format applied on top of Code 128. The main advantage of GS1-128 is consistent global data interpretation, eliminating misinterpretation and ambiguity. This standardization is crucial for supply chain management where products move between different companies and countries.
However, due to strict formatting, missing a hidden control character or incorrect field length will render the barcode non-compliant. If you encounter issues with GS1-128 formatting, our GS1-128 troubleshooting guide can help resolve common problems.
What Format Does GSI-128 Require?
Barcode scanners use Application Identifiers (AI) ‒ numeric prefixes that identify the information in the product code. Understanding these identifiers is crucial for creating compliant barcodes that work across the global supply chain.
GS1-128 follows this four-part data structure:
(Numeric prefix 01) GTIN (Global Trade Item Number): The unique product ID that identifies what the product is. Must be exactly 14 numeric digits. If your product code is shorter, pad with leading zeros. For example, 123456789012 becomes 00123456789012.
(Numeric prefix 10) Batch/Lot: The batch or lot number of the product. 1 to 20 alphanumeric characters. When placed mid-barcode, requires FNC1 separator character so scanners know where it ends. No separator needed if at barcode end.
(Numeric prefix 17) Expiration Date: The product's expiration date. Fixed at six digits following YYMMDD format. For example, 251231 is December 31, 2025. Uses 2-digit years with sliding window for century.
(Numeric prefix 21) Serial Number: The product's serial number identifying the unique individual unit. Variable-length with 1-20 alphanumeric characters.
How Do I Generate GSI-128 with IronBarcode?
Generating a GS1-128 barcode is easy; pass BarcodeEncoding.Code128GS1 as the second parameter when calling Create.
The example below shows a full GS1-128-compliant value with all four attributes and exports it as an image.
:path=/static-assets/barcode/content-code-examples/how-to/create-gsi-128-barcode.cs
using IronBarCode;
// Valid GS1-128 String: GTIN + Expiry + Batch + Serial Number
string gs1Value = "(01)01234567890128(17)251231(10)BATCH001(21)111111";
// Create the barcode
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(gs1Value, BarcodeEncoding.Code128GS1);
// Display the value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("gsi128-sample.jpg");
Imports IronBarCode
' Valid GS1-128 String: GTIN + Expiry + Batch + Serial Number
Dim gs1Value As String = "(01)01234567890128(17)251231(10)BATCH001(21)111111"
' Create the barcode
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(gs1Value, BarcodeEncoding.Code128GS1)
' Display the value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("gsi128-sample.jpg")
What Does the GSI-128 Output Look Like?
How Do I Fix GSI-128 Format Errors?
If your string doesn't comply with GS1-128 standards, IronBarcode throws an exception. Verify your string value using the table above and modify accordingly.
How Do I Create Code 39 Barcodes?
Code 39 is one of the first alphanumeric barcode standards, known for reliability. Common in automotive and defense sectors. Its ability to encode letters and numbers without check digits makes it simple for environments where data integrity is verified through other means.
However, Code 39 has a limited character set. It only allows uppercase English characters, digits, and symbols like /, ., -, etc. Standard mode doesn't support lowercase. For information on reading standard and extended Code 39 barcodes, see our Code 39 reading guide.
What Code Do I Need for Code 39?
To generate Code39, pass BarcodeEncoding.Code39 as the second parameter when using Create.
Here's an example:
:path=/static-assets/barcode/content-code-examples/how-to/create-code-39-barcode.cs
using IronBarCode;
// Specify Code39 Format
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode("IRON-1234", BarcodeEncoding.Code39);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("code39.jpg");
Imports IronBarCode
' Specify Code39 Format
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("IRON-1234", BarcodeEncoding.Code39)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("code39.jpg")
What Does Code 39 Output Look Like?
Why Am I Getting Code 39 Errors?
If the string doesn't conform to Code39 standard, IronBarcode throws this exception.
How Do I Create Code 93 Barcodes?
Code 93 improves on Code 39, commonly used in logistics and electronic component labeling where space is limited but alphanumeric data is required. The improved density suits small electronic components where space matters.
It accepts full ASCII characters, uppercase English letters, digits, and symbols. Offers higher density than Code 39.
What Code Do I Need for Code 93?
To generate Code93, pass BarcodeEncoding.Code93 as the second parameter when using Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-code-93-barcode.cs
using IronBarCode;
// Valid Input: Uppercase A-Z, 0-9, specific symbols
string code93Value = "ELEC-COMP-99";
// Create Code 93
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(code93Value, BarcodeWriterEncoding.Code93);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("code93.jpg");
Imports IronBarCode
' Valid Input: Uppercase A-Z, 0-9, specific symbols
Dim code93Value As String = "ELEC-COMP-99"
' Create Code 93
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(code93Value, BarcodeWriterEncoding.Code93)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("code93.jpg")
What Does Code 93 Output Look Like?
How Do I Create CodaBar Barcodes?
Codabar is robust against poor print quality, widely used in blood banks and libraries. The format's error tolerance is ideal for low-quality printers or wear and tear.
Variable-length but limited character set. Contains only digits (0-9) and symbols (-, $, :, /, ., +). Start/stop characters A, B, C, D indicate beginning or end. These characters can't appear mid-barcode.
What Code Do I Need for CodaBar?
To generate Codabar, pass BarcodeEncoding.Codabar as the second parameter when using Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-codabar-barcode.cs
using IronBarCode;
// Valid Input: Numbers 0-9 and symbols -$:/.+ IronBarcode automatically appends by A, B, C, or D
string codabarValue = "10500200";
// Create Codabar
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(codabarValue, BarcodeWriterEncoding.Codabar);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("codabar.jpg");
Imports IronBarCode
' Valid Input: Numbers 0-9 and symbols -$:/.+ IronBarcode automatically appends by A, B, C, or D
Dim codabarValue As String = "10500200"
' Create Codabar
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(codabarValue, BarcodeWriterEncoding.Codabar)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("codabar.jpg")
What Does CodaBar Output Look Like?
Why Is CodaBar Throwing Errors?
If input contains letters, IronBarcode throws an exception stating it only accepts numeric values.
How Do I Create DataBar Barcodes?
GS1 DataBar (formerly RSS-14) is more compact, designed for product identification numbers. Useful for small items like fresh produce where traditional barcodes take too much space. Learn more about newer format capabilities in our new formats milestone update.
Like GS1-128, it has strict encoding format. The Omnidirectional variant contains only the product code attribute.
What Format Does GS1-DataBar Require?
(Numeric prefix-01) GTIN (Global Trade Item Number): The unique product ID. Must be exactly 14 numeric digits.
How Do I Generate GS1 DataBar Code?
To generate GS1 DataBar, pass BarcodeEncoding.DataBar as the second parameter when using Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-gs1-databar-barcode.cs
using IronBarCode;
// Valid Input: Exactly 14 digits (GTIN). IronBarcode will calculate and append the correct check digit
string databarValue = "0123456789012";
// Create GS1 DataBar
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(databarValue, BarcodeWriterEncoding.DataBar);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("databar.jpg");
Imports IronBarCode
' Valid Input: Exactly 14 digits (GTIN). IronBarcode will calculate and append the correct check digit
Dim databarValue As String = "0123456789012"
' Create GS1 DataBar
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(databarValue, BarcodeWriterEncoding.DataBar)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("databar.jpg")
What Does DataBar Output Look Like?
How Do I Create EAN-13 Barcodes?
EAN-13 is the standard retail barcode used worldwide for consumer products—one of the most widely used formats. For retail applications, explore how to customize barcode styling to match brand requirements.
EAN-13 requires strict licensing. You can't generate EAN-13 numbers for public use without licensing a GS1 Company Prefix to ensure unique barcodes. Contains only 13 numeric digits. For licensing information, visit our licensing page.
EAN-13 has specific formatting rules.
What Format Does EAN-13 Require?
EAN-13 barcode consists of four parts:
GS1 Prefix (First 3 Digits): Identifies GS1 Member Organization, typically registration country. Examples: 000-019 (USA/Canada - UPC compatible), 500-509 (UK), 450-459 (Japan).
Manufacturer Code: Variable-length code assigned by GS1.
Product Code: Assigned by manufacturer to specific item.
Check Digit (Last Digit): Calculated from first 12 using Modulo 10 algorithm. Ensures accurate scanner reading.
How Do I Generate EAN-13 Code?
To generate EAN-13, pass BarcodeEncoding.EAN13 as the second parameter when using Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-ean13-barcode.cs
using IronBarCode;
// Valid Input: 12 digits (library calculates 13th check digit) or full 13 digits.
string ean13Value = "4006381333931";
// Create EAN-13
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(ean13Value, BarcodeWriterEncoding.EAN13);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("ean13.jpg");
Imports IronBarCode
' Valid Input: 12 digits (library calculates 13th check digit) or full 13 digits.
Dim ean13Value As String = "4006381333931"
' Create EAN-13
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(ean13Value, BarcodeWriterEncoding.EAN13)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("ean13.jpg")
What Does EAN-13 Output Look Like?
How Do I Fix EAN-13 Format Errors?
IronBarcode throws an exception for non-numeric values.
How Do I Create EAN-8 Barcodes?
EAN-8 is the condensed EAN-13 version for small consumer products where full-size barcodes take too much space. Common on pencils and cosmetics where packaging space is limited.
Unlike Code 128 or Code 39, EAN-8 uses specific assigned prefixes rather than arbitrary numbers.
EAN-8 uses strict 8-digit format: 7 data digits and 1 check digit. Numeric only.
What Code Do I Need for EAN-8?
Creating EAN-8 requires passing BarcodeEncoding.EAN8 to the second parameter when using Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-ean8-barcode.cs
using IronBarCode;
// Valid Input: 7 digits (library calculates 8th check digit).
string ean8Value = "1234567";
// Create EAN-8
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(ean8Value, BarcodeWriterEncoding.EAN8);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("ean8.jpg");
Imports IronBarCode
' Valid Input: 7 digits (library calculates 8th check digit).
Dim ean8Value As String = "1234567"
' Create EAN-8
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(ean8Value, BarcodeWriterEncoding.EAN8)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("ean8.jpg")
What Does EAN-8 Output Look Like?
Why Am I Getting EAN-8 Length Errors?
If input contains 8+ numeric characters, IronBarcode throws an exception stating EAN-8 requires 8 characters.
How Do I Create Intelligent Mail Barcodes?
Intelligent Mail Barcode (IMB) is the USPS standard for automating mail sorting and tracking. Unlike traditional width-modulated barcodes, IMB uses height-modulated bars. Mandatory for automation price discounts on letters and flats. Supports only specific numeric lengths: 20, 25, 29, or 31 digits.
Uses specific numeric prefixes to define information.
What Format Does Intelligent Mail Require?
(First 2 Digits) Barcode ID: The Barcode Identifier. Strictly 2 numeric digits. Usually 00 for standard commercial mail.
(Next 3 Digits) Service Type ID (STID): Defines mail class (e.g., First Class, Marketing Mail) and services (e.g., Address Correction, Tracking). Critical for postal discounts.
(Next 6 or 9 Digits) Mailer ID (MID): 6- or 9-digit number assigned by USPS to your company.
(Next 6 or 9 Digits) Serial Number: Identifies unique individual mailpiece.
(Last 0, 5, 9, or 11 Digits) Routing Code: Delivery ZIP code.
How Do I Generate Intelligent Mail Code?
To generate IMB, pass BarcodeEncoding.IntelligentMail as the second parameter when calling Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-imb-barcode.cs
using IronBarCode;
// Valid Input: 20, 25, 29, or 31 digits.
// Format: Barcode ID(2) + Service(3) + Mailer ID(6/9) + Serial(9/6) + Routing Zip(0/5/9/11)
string imbValue = "00270123456200800001";
// Create Intelligent Mail
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(imbValue, BarcodeWriterEncoding.IntelligentMail);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("imb.jpg");
Imports IronBarCode
' Valid Input: 20, 25, 29, or 31 digits.
' Format: Barcode ID(2) + Service(3) + Mailer ID(6/9) + Serial(9/6) + Routing Zip(0/5/9/11)
Dim imbValue As String = "00270123456200800001"
' Create Intelligent Mail
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(imbValue, BarcodeWriterEncoding.IntelligentMail)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("imb.jpg")
What Does Intelligent Mail Output Look Like?
How Do I Fix Intelligent Mail Format Errors?
IronBarcode throws an exception if format is incorrect. Verify string value against format above and retry after modification.
How Do I Create MSI Barcodes?
MSI is common on retail shelf tags and warehouse inventory control, rarely on consumer products. Its simplicity and reliability make it popular for internal operations. For MSI recognition issues, check our MSI barcode troubleshooting guide.
MSI is numeric-only; no letters or symbols allowed. Variable length, typically 10-15 digits.
What Code Do I Need for MSI?
To generate MSI, pass BarcodeEncoding.MSI as the second parameter when calling Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-msi-barcode.cs
using IronBarCode;
// Valid Input: Numeric digits only. Variable length.
string msiValue = "1234567890";
// Create MSI
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(msiValue, BarcodeWriterEncoding.MSI);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("msi.jpg");
Imports IronBarCode
' Valid Input: Numeric digits only. Variable length.
Dim msiValue As String = "1234567890"
' Create MSI
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(msiValue, BarcodeWriterEncoding.MSI)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("msi.jpg")
What Does MSI Output Look Like?
How Do I Create UPC-A Barcodes?
UPC-A is the standard retail barcode for United States and Canada. A 12-digit subset of EAN-13. Most common on products in North American supermarkets. Widespread adoption makes it essential for North American markets.
Like EAN-13, typically assigned rather than generated.
UPC-A contains exactly 12 numeric digits. No letters accepted.
What Format Does UPC-A Require?
Number System Character (1): Identifies product type (0, 1, 6, 7, 8 for standard retail; 2 for random weight; 3 for drugs; 5 for coupons).
Manufacturer Code (5): Assigned by GS1.
Product Code (5): Assigned by manufacturer.
Check Digit (1): Calculated modulo 10 checksum.
How Do I Generate UPC-A Code?
To generate UPC-A, pass BarcodeEncoding.UPCA as the second parameter when calling Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-upc-a-barcode.cs
using IronBarCode;
// Valid Input: 11 digits (library calculates 12th check digit) or full 12 digits
string upcaValue = "01234567890";
// Create UPC-A
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(upcaValue, BarcodeWriterEncoding.UPCA);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG
barcode.SaveAsJpeg("upca.jpg");
Imports IronBarCode
' Valid Input: 11 digits (library calculates 12th check digit) or full 12 digits
Dim upcaValue As String = "01234567890"
' Create UPC-A
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(upcaValue, BarcodeWriterEncoding.UPCA)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG
barcode.SaveAsJpeg("upca.jpg")
What Does UPC-A Output Look Like?
Why Am I Getting UPC-A Length Errors?
IronBarcode throws an error if the numeric value exceeds 13 in length.
How Do I Create UPC-E Barcodes?
UPC-E is the compact UPC-A version for small retail packaging like soda cans where full 12-digit UPC-A is too large. The compression algorithm encodes the same information in roughly half the space.
Like UPC-A, strictly numeric. No letters or symbols accepted.
What Code Do I Need for UPC-E?
To generate UPC-E, pass BarcodeEncoding.UPCE as the second parameter when calling Create:
:path=/static-assets/barcode/content-code-examples/how-to/create-upc-e-barcode.cs
using IronBarCode;
// Valid input: 8 digits or less in which the last digit is a check digit
// IronBarcode automatically calculates the check digit if only 7 digits are provided.
string upceValue = "0123456";
// Create UPC-E
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(upceValue, BarcodeWriterEncoding.UPCE);
// Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
barcode.SaveAsJpeg("upce.jpg");
Imports IronBarCode
' Valid input: 8 digits or less in which the last digit is a check digit
' IronBarcode automatically calculates the check digit if only 7 digits are provided.
Dim upceValue As String = "0123456"
' Create UPC-E
Dim barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(upceValue, BarcodeWriterEncoding.UPCE)
' Stamp barcode value below the barcode
barcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
barcode.SaveAsJpeg("upce.jpg")
What Does UPC-E Output Look Like?
How Do I Fix UPC-E Length Errors?
IronBarcode throws an error if numeric digits exceed 8.
What Are the Different 1D Barcode Types?
| Name | Format | Common Usage | Restrictions & Pitfalls |
|---|---|---|---|
| Code 128 | Alphanumeric Full ASCII 128 supported. Variable length. High density. |
Internal logistics, shipping labels, asset tracking, ID cards. |
|
| GS1-128 | Structured Alphanumeric Code 128 with leading FNC1 + Application Identifiers (e.g., (01)). |
Global supply chain (Walmart/Amazon), pallet labels, EDI. |
|
| Code 39 | Alphanumeric (Restricted) Uppercase A-Z, 0-9, and -. $ / + % space. |
Automotive (AIAG), Defense (LOGMARS), legacy industrial IDs. |
|
| Code 93 | Alphanumeric Similar to Code 39 but with a higher density. |
Electronics (PCBs), Canada Post, and internal manufacturing. |
|
| Codabar | Numeric + Symbols 0-9 and - $ : /. +. Start/Stop: A, B, C, D. |
Blood banks, Libraries, FedEx Airbills (Legacy). |
|
| GS1 DataBar | Numeric (14 Digits) Encodes GTIN-14 only. Extremely compact. |
Loose produce (fruit stickers), small cosmetics, and healthcare vials. |
|
| EAN-13 | Numeric (13 Digits) Country + Mfg + Product + Check Digit. |
Global Retail Point-of-Sale (Supermarkets). |
|
| EAN-8 | Numeric (8 Digits) 7 Data + 1 Check Digit. |
Tiny retail packages (chewing gum, pencils). |
|
| Intelligent Mail | Numeric (20, 25, 29, 31 Digits) Height-modulated (4-state) bars. |
USPS Mail Sorting & Automation. |
|
| MSI (Plessey) | Numeric Only Variable length. |
Retail shelf tags, warehouse bins. |
|
| UPC-A | Numeric (12 Digits) 11 Data + 1 Check Digit. |
North American Retail Point-of-Sale. |
|
| UPC-E | Numeric (6 Digits) Compressed format. |
Small retail packaging (Soda cans) in the US/Canada. |
|
Frequently Asked Questions
What types of 1D barcodes can be generated?
IronBarcode can generate all major 1D barcode formats including Code 128, GS1-128, Code 39, Code 93, EAN-13, EAN-8, UPC-A, UPC-E, Intelligent Mail, MSI, Codabar, and DataBar. Each format is suitable for different applications - Code 128 for shipping labels, EAN-8 for small products, and Intelligent Mail Barcode for postal services.
How do I create a basic 1D barcode in C#?
To create a 1D barcode with IronBarcode, use the BarcodeWriter.CreateBarcode() method with your data string and specify the barcode type using the BarcodeEncoding enum. For example: GeneratedBarcode barcode = BarcodeWriter.CreateBarcode("HELLO-WORLD-123", BarcodeEncoding.Code128);
What output formats are supported for saving barcodes?
IronBarcode supports saving generated barcodes in multiple formats including JPEG, PNG, and PDF. You can use methods like SaveAsJpeg(), SaveAsPng(), or other SaveAs methods to export your barcode in the desired format.
Can I customize the size and appearance of generated barcodes?
Yes, IronBarcode allows you to customize barcode dimensions using the ResizeTo() method. You can also apply optional styling with font size and margins to ensure the barcode fits your specific requirements.
Does the library include automatic validation for barcode formats?
IronBarcode includes automatic validation and compliance checking for all supported barcode formats. This ensures that generated barcodes meet industry standards and will be scannable by standard barcode readers.
Why should I use linear barcodes instead of 2D barcodes?
Linear barcodes remain the industry standard because they are fast, reliable, and work with almost any scanner. Since they don't require complex image processing, IronBarcode's linear barcodes excel in high-speed environments like retail checkout lines and conveyor belts.

