# How to create 2D barcodes
IronBarcode enables you to generate all major 2D barcode formats including QR Code, Aztec, `DataMatrix`, `MaxiCode`, `PDF417`, and the new `rMQR` format with simple C# code. Simply pass the desired encoding type to the `CreateBarcode` method and export as an image. With support for [over 30 barcode formats](https://ironsoftware.com/csharp/barcode/get-started/supported-barcode-formats/), IronBarcode provides a comprehensive solution for all your barcode generation needs.
When storing detailed information in a small space, 2D barcodes are the definitive industry solution. They hold thousands of characters while remaining readable even when torn, scratched, or marked. Because they can be scanned from any angle and don't require perfect alignment, these barcodes are ideal for fast-paced logistics and mobile scanning applications. Built-in error correction ensures your data remains accessible even in challenging conditions.
The main challenge is selecting the correct format for your specific needs. You might need Aztec Code's borderless compact design for mobile ticketing, `DataMatrix`'s industrial precision for tiny electronic components, or `PDF417`'s massive offline storage capacity for driver's licenses and ID cards. With IronBarcode, you can generate all these formats reliably and efficiently.
In this guide, we'll cover how to generate critical 2D formats like QR Code, `MaxiCode`, and the new `rMQR`, along with their everyday use cases.
<hr />
*as-heading:2(Quickstart: Generate Your First 2D Barcode)*
Use IronBarcode's simple API to create a QR Code from a string and save it as a PNG image. Get started immediately - supply the data, choose the encoding and size, and write your image file.
```cs
:title=Generate 2D Barcode Instantly
IronBarCode.BarcodeWriter.CreateBarcode("Hello World", BarcodeEncoding.QRCode, 250, 250).SaveAsPng("myQRCode.png");
```
<div class="hsg-featured-snippet">
<h2>How to Create 2D Barcodes with IronBarcode</h2>
<ol>
<li><a class="js-modal-open" data-modal-id="trial-license-after-download" href="https://www.nuget.org/packages/BarCode/">Download the IronBarcode C# library to create barcodes</a></li>
<li>Generate a barcode with a string value with <code>CreateBarcode</code></li>
<li>Specify the barcode type with <code>BarcodeEncoding</code></li>
<li>Save the barcode as an image or other format with <code>SaveAsJpeg</code></li>
</ol>
</div>
## What are 2D barcodes and when should I use them?
Two-dimensional barcodes like QR Codes use a grid of squares or dots to store information both horizontally and vertically. In contrast, linear one-dimensional barcodes use a single row of lines to store data. While standard barcodes hold only a few numbers or letters, 2D codes can store massive amounts of data - including web links, ID details, or entire files - without requiring a database connection.
This reliable design makes 2D barcodes incredibly durable. Built-in error correction allows scanning even when barcodes are scratched, torn, or marked, where typical barcodes would fail. This makes 2D barcodes ideal for harsh environments or mobile scanning where perfect conditions aren't guaranteed. For more information on fine-tuning error correction, see [our error correction guide](https://ironsoftware.com/csharp/barcode/how-to/error-correction/).
One behaviour applies across every format below: a UTF-8 ECI header is added only when the encoded data contains non-ASCII characters, which keeps ASCII payloads compact and readable on legacy scanners. See [how to control ECI encoding](https://ironsoftware.com/csharp/barcode/how-to/eci-encoding/) to override it.
Let's explore all 2D barcode formats supported by IronBarcode, demonstrate how to create them, and discuss their common uses. Each format has unique characteristics suited to specific applications.
### How do I create an Aztec barcode for mobile ticketing?
Aztec Code is a high-density 2D matrix recognized by its square bullseye pattern at the center. Unlike other formats, Aztec codes are space-efficient and store data in a compact square format.
Aztec code's unique advantage is that it requires no quiet zone, unlike other barcodes. It's commonly used for mobile ticketing like electronic boarding passes and healthcare patient wristbands. Airlines and transit systems prefer this format for its compact size and excellent readability on smartphone screens.
#### Code
IronBarcode makes generating Aztec codes simple: pass `BarcodeEncoding.Aztec` as the second parameter when calling the `CreateBarcode` method, then export the result as an image. You can further [customize the appearance](https://ironsoftware.com/csharp/barcode/how-to/customize-barcode-style/) using IronBarcode's styling options.
```cs
using IronBarCode;
// Create the Aztec barcode
GeneratedBarcode AztecCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Aztec);
// Display the value below the barcode
AztecCode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
AztecCode.SaveAsJpeg("aztec-sample.jpg");
```
#### Output
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/aztec-sample.webp" alt="Aztec barcode example showing the characteristic bullseye pattern" class="img-responsive add-shadow" />
</div>
</div>
### How do I create a DataMatrix barcode for industrial part marking?
Data Matrix is a compact 2D matrix recognized by the L-shaped finder pattern on its perimeter. This format excels where space is limited and durability is critical.
Data Matrix's unique strength is extreme durability and ability to scale down to microscopic sizes for direct part marking (DPM). It's commonly used for industrial tracking on surgical instruments, electronic components, and aerospace parts where space is severely limited. The format's compact size and high data density are perfect for [creating barcodes from various data types](https://ironsoftware.com/csharp/barcode/how-to/create-barcode-from-data/) including serial numbers and batch codes.
#### Code
IronBarcode makes generating `DataMatrix` codes simple: pass `BarcodeEncoding.DataMatrix` as the second parameter when calling the `CreateBarcode` method, then export the result as an image.
```cs
using IronBarCode;
// Create the DataMatrix barcode
GeneratedBarcode DataMatrix = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.DataMatrix);
// Display the value below the barcode
DataMatrix.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
DataMatrix.SaveAsJpeg("dataMatrix-sample.jpg");
```
#### Output
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/dataMatrix-sample.webp" alt="DataMatrix barcode example displaying the L-shaped finder pattern" class="img-responsive add-shadow" />
</div>
</div>
### How do I create a MaxiCode barcode for shipping labels?
`MaxiCode` is a fixed-size 2D matrix recognized by its circular bullseye pattern surrounded by a hexagonal grid. This unique design was engineered specifically for high-speed scanning on conveyor belts.
MaxiCode's unique aspect is its constant 1-inch physical size regardless of stored data, optimizing it for high-speed conveyor belt reading. It's commonly used in logistics and supply chain management, specifically on UPS shipping labels for automated package sorting and routing. The fixed size ensures consistent scanning performance regardless of data payload.
#### Code
IronBarcode makes generating `MaxiCode` simple: pass `BarcodeEncoding.MaxiCode` as the second parameter when calling the `CreateBarcode` method, then export it as an image. For more examples, check our [barcode quickstart guide](https://ironsoftware.com/csharp/barcode/examples/barcode-quickstart/).
```cs
using IronBarCode;
// Create the MaxiCode barcode
GeneratedBarcode MaxiCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.MaxiCode);
// Display the value below the barcode
MaxiCode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
MaxiCode.SaveAsJpeg("maxiCode-sample.jpg");
```
#### Output
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/maxiCode-sample.webp" alt="MaxiCode barcode example with hexagonal pattern and circular bullseye" class="img-responsive add-shadow" />
</div>
</div>
### How do I create a PDF417 barcode for ID cards?
`PDF417` is a stacked linear barcode recognized by its wide, rectangular appearance resembling digital static. This format encodes significantly more data than other 2D formats, making it ideal for storing detailed information.
PDF417's unique capability is serving as a portable data file, storing large amounts of data like photos, names, and biometric records without requiring database connections. It's commonly used for government identification like driver's licenses and printed airline boarding passes. The format supports both text and binary data encoding.
#### Code
IronBarcode makes generating `PDF417` simple: pass `BarcodeEncoding.PDF417` as the second parameter when calling the `CreateBarcode` method, then export it as an image. You can also [save barcodes in various image formats](https://ironsoftware.com/csharp/barcode/how-to/create-barcode-images/) including PNG, JPEG, and more.
```cs
using IronBarCode;
// Create PDF417 barcode
GeneratedBarcode PDF417code = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.PDF417);
// Display the value below the barcode
PDF417code.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
PDF417code.SaveAsJpeg("pdf417-sample.jpg");
```
#### Output
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/pdf417-sample.webp" alt="PDF417 barcode example showing stacked linear pattern" class="img-responsive add-shadow" />
</div>
</div>
### How do I create a QR Code for marketing campaigns?
A QR Code is a high-density 2D matrix recognized by three distinctive square finder patterns in its corners. As the most widely recognized 2D barcode format, QR codes have become ubiquitous in consumer applications.
QR Code's unique advantage is universal consumer accessibility - it's the only 2D symbology natively supported by virtually all modern smartphone camera apps without additional software. It's commonly used for marketing and public engagement, linking to websites and digital menus, and facilitating mobile payments. For advanced QR code generation, explore our [QR code creation examples](https://ironsoftware.com/csharp/barcode/examples/csharp-create-qr-code/).
#### Code
IronBarcode makes generating QR codes simple: pass `BarcodeEncoding.QRCode` as the second parameter when calling the `CreateBarcode` method, then export it as an image. You can also [customize QR code styles](https://ironsoftware.com/csharp/barcode/how-to/customize-qr-code-style/) by adding logos and changing colors.
```cs
using IronBarCode;
// Create QR Code
GeneratedBarcode QRcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.QRCode);
// Display the value below the barcode
QRcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
QRcode.SaveAsJpeg("QRcode.jpg");
```
#### Output
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/QRcode.webp" alt="QR Code example with three corner finder patterns" class="img-responsive add-shadow" />
</div>
</div>
### How do I create a Micro QR Code for small electronics?
A Micro QR Code is a miniaturized 2D matrix recognized by its single square finder pattern in the top-left corner. This format was designed specifically for applications where space is extremely limited.
Due to its miniaturized size, character limits apply. The largest version (M4) holds a maximum of 21 alphanumeric characters or 35 numbers. Carefully plan your data encoding strategy when using Micro QR codes.
#### Code
IronBarcode makes generating `MicroQRCode` simple: pass `BarcodeEncoding.MicroQRCode` as the second parameter when calling the `CreateBarcode` method, then export it as an image.
```cs
using IronBarCode;
// Create a Micro QR Code
GeneratedBarcode microQRcode = BarcodeWriter.CreateBarcode("IRON-1234", BarcodeEncoding.MicroQRCode);
// Display the value below the barcode
microQRcode.AddBarcodeValueTextBelowBarcode();
// Save to file as Jpeg
microQRcode.SaveAsJpeg("microQRCode.jpg");
```
#### Output
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/MicroQRcode.webp" alt="Micro QR Code example with single finder pattern" class="img-responsive add-shadow" />
</div>
</div>
#### What happens if my data exceeds Micro QR capacity?
IronBarcode throws an error if the input string exceeds 35 numeric digits or 21 alphanumeric characters. This built-in validation helps prevent runtime errors in production environments.
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/micromqerror.webp" alt="Error message displayed when Micro QR Code data capacity is exceeded" class="img-responsive add-shadow" />
</div>
</div>
### How do I create an rMQR Code for narrow spaces?
Rectangular Micro QR Code (`rMQR`) is a specialized 2D matrix recognized by its elongated, strip-like shape and single finder pattern in the top-left corner. This innovative format addresses a specific gap in barcode technology.
Due to its rectangular design, it stretches horizontally to increase capacity without increasing vertical footprint. The largest version (R17x139) contains up to 219 alphanumeric characters or 361 numbers - significantly more capable than `MicroQRCode` while maintaining a slim profile.
#### Code
IronBarcode makes generating `RMQRCode` simple: pass `BarcodeEncoding.RMQRCode` as the second parameter when calling the `CreateBarcode` method, then export it as an image. For a comprehensive overview of all IronBarcode features, visit our [API reference](https://ironsoftware.com/csharp/barcode/object-reference/api/).
```cs
using IronBarCode;
// Create a RmQR Code
GeneratedBarcode rMqrCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.RMQRCode);
// Display the value below the barcode
rMqrCode.AddBarcodeValueTextBelowBarcode();
// Save to file as Jpeg
rMqrCode.SaveAsJpeg("rmQRcode.jpg");
```
#### Output
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/rmQRcode.webp" alt="rMQR Code example showing rectangular format" class="img-responsive add-shadow" />
</div>
</div>
#### What happens if my data exceeds rMQR capacity?
IronBarcode throws an error if the input string exceeds 361 numeric digits or 219 alphanumeric characters. This validation ensures your barcodes remain scannable and compliant with the `rMQR` specification.
<div class="content-img-align-center">
<div class="center-image-wrapper" style="width=50%">
<img src="/static-assets/barcode/how-to/create-2d-barcodes/rmqr-error.webp" alt="Error message shown when rMQR Code capacity limit is exceeded" class="img-responsive add-shadow" />
</div>
</div>
#### Which 2D barcode format should I choose?
<table border="1" cellspacing="0" cellpadding="8" class="table table__configuration-variables">
<thead style="background-color: #f2f2f2;">
<tr>
<th style="width: 15%;">Name</th>
<th style="width: 25%;">Format</th>
<th style="width: 25%;">Common Usage</th>
<th style="width: 35%;">Restrictions & Pitfalls</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Aztec Code</strong></td>
<td><strong>Matrix (Center-Out)</strong><br />Square grid with central "bullseye" finder. No quiet zone required.</td>
<td>Mobile boarding passes (Apple Wallet), train tickets, and healthcare wristbands.</td>
<td>
<ul>
<li><strong>Center Damage:</strong> Relies on center finder; bullseye damage causes total failure.</li>
<li><strong>Screen Glare:</strong> Reflective phone screens can blind standard scanners.</li>
</ul>
</td>
</tr>
<tr>
<td><strong>Data Matrix</strong></td>
<td><strong>Matrix (L-Pattern)</strong><br />Square or rectangular with solid "L" border on two sides.</td>
<td>Electronics components, surgical instruments, and Direct Part Marking (DPM) on metal.</td>
<td>
<ul>
<li><strong>Quiet Zone:</strong> Requires 1-module white border; edge graphics cause failures.</li>
<li><strong>Contrast:</strong> Shiny metal (DPM) requires specialized lighting to read.</li>
</ul>
</td>
</tr>
<tr>
<td><code>MaxiCode</code></td>
<td><strong>Fixed Size Matrix</strong><br />Exactly 1x1 inch. Hexagonal dots with central circular bullseye.</td>
<td>UPS Shipping labels and high-speed conveyor belt sorting.</td>
<td>
<ul>
<li><strong>Fixed Size:</strong> Cannot shrink below 1 inch tall.</li>
<li><strong>Printer Quality:</strong> Low-resolution thermal printers distort hexagons.</li>
</ul>
</td>
</tr>
<tr>
<td><code>PDF417</code></td>
<td><strong>Stacked Linear</strong><br />Wide rectangle resembling digital static. High capacity.</td>
<td>Driver's Licenses (AAMVA), ID cards, and paper boarding passes.</td>
<td>
<ul>
<li><strong>Truncation:</strong> Handheld scanners often miss left/right edges.</li>
<li><strong>Size Growth:</strong> Physical size increases significantly with more data.</li>
</ul>
</td>
</tr>
<tr>
<td><strong>QR Code</strong></td>
<td><strong>Matrix</strong><br />Square with three distinctive corner finder patterns.</td>
<td>Consumer marketing, payments, restaurant menus, Wi-Fi pairing.</td>
<td>
<ul>
<li><strong>Quiet Zone:</strong> Requires large white margin (4 modules wide).</li>
<li><strong>Density:</strong> Long URLs without shortening create unfocusable "static".</li>
</ul>
</td>
</tr>
<tr>
<td><strong>Micro QR</strong></td>
<td><strong>Miniature Matrix</strong><br />Tiny square with only one corner finder pattern.</td>
<td>Printed Circuit Boards (PCBs), small electrical components.</td>
<td>
<ul>
<li><strong>Capacity Limit:</strong> Max ~35 numeric or 21 alphanumeric characters.</li>
<li><strong>Scanner Support:</strong> Not supported by all smartphone camera apps.</li>
</ul>
</td>
</tr>
<tr>
<td><code>rMQR</code></td>
<td><strong>Rectangular Matrix</strong><br />Long, narrow strip bridging Micro QR and standard QR.</td>
<td>Test tubes, cables, thin bezels, narrow product edges.</td>
<td>
<ul>
<li><strong>New Format:</strong> Growing support but not universal on legacy scanners.</li>
<li><strong>Aspect Ratio:</strong> Designed strictly for narrow spaces.</li>
</ul>
</td>
</tr>
</tbody>
</table>
IronBarcode enables you to generate all major 2D barcode formats including QR Code, Aztec, DataMatrix, MaxiCode, PDF417, and the new rMQR format with simple C# code. Simply pass the desired encoding type to the CreateBarcode method and export as an image. With support for over 30 barcode formats, IronBarcode provides a comprehensive solution for all your barcode generation needs.
When storing detailed information in a small space, 2D barcodes are the definitive industry solution. They hold thousands of characters while remaining readable even when torn, scratched, or marked. Because they can be scanned from any angle and don't require perfect alignment, these barcodes are ideal for fast-paced logistics and mobile scanning applications. Built-in error correction ensures your data remains accessible even in challenging conditions.
The main challenge is selecting the correct format for your specific needs. You might need Aztec Code's borderless compact design for mobile ticketing, DataMatrix's industrial precision for tiny electronic components, or PDF417's massive offline storage capacity for driver's licenses and ID cards. With IronBarcode, you can generate all these formats reliably and efficiently.
In this guide, we'll cover how to generate critical 2D formats like QR Code, MaxiCode, and the new rMQR, along with their everyday use cases.
Quickstart: Generate Your First 2D Barcode
Use IronBarcode's simple API to create a QR Code from a string and save it as a PNG image. Get started immediately - supply the data, choose the encoding and size, and write your image file.
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
What are 2D barcodes and when should I use them?
Two-dimensional barcodes like QR Codes use a grid of squares or dots to store information both horizontally and vertically. In contrast, linear one-dimensional barcodes use a single row of lines to store data. While standard barcodes hold only a few numbers or letters, 2D codes can store massive amounts of data - including web links, ID details, or entire files - without requiring a database connection.
This reliable design makes 2D barcodes incredibly durable. Built-in error correction allows scanning even when barcodes are scratched, torn, or marked, where typical barcodes would fail. This makes 2D barcodes ideal for harsh environments or mobile scanning where perfect conditions aren't guaranteed. For more information on fine-tuning error correction, see our error correction guide.
One behaviour applies across every format below: a UTF-8 ECI header is added only when the encoded data contains non-ASCII characters, which keeps ASCII payloads compact and readable on legacy scanners. See how to control ECI encoding to override it.
Let's explore all 2D barcode formats supported by IronBarcode, demonstrate how to create them, and discuss their common uses. Each format has unique characteristics suited to specific applications.
How do I create an Aztec barcode for mobile ticketing?
Aztec Code is a high-density 2D matrix recognized by its square bullseye pattern at the center. Unlike other formats, Aztec codes are space-efficient and store data in a compact square format.
Aztec code's unique advantage is that it requires no quiet zone, unlike other barcodes. It's commonly used for mobile ticketing like electronic boarding passes and healthcare patient wristbands. Airlines and transit systems prefer this format for its compact size and excellent readability on smartphone screens.
Code
IronBarcode makes generating Aztec codes simple: pass BarcodeEncoding.Aztec as the second parameter when calling the CreateBarcode method, then export the result as an image. You can further customize the appearance using IronBarcode's styling options.
using IronBarCode;// Create the Aztec barcodeGeneratedBarcodeAztecCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Aztec);// Display the value below the barcodeAztecCode.AddBarcodeValueTextBelowBarcode();// Save as a JPG fileAztecCode.SaveAsJpeg("aztec-sample.jpg");
using IronBarCode;
// Create the Aztec barcode
GeneratedBarcode AztecCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Aztec);
// Display the value below the barcode
AztecCode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
AztecCode.SaveAsJpeg("aztec-sample.jpg");
ImportsIronBarCode' Create the Aztec barcodeDimAztecCodeAsGeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Aztec)' Display the value below the barcodeAztecCode.AddBarcodeValueTextBelowBarcode()' Save as a JPG fileAztecCode.SaveAsJpeg("aztec-sample.jpg")
Imports IronBarCode
' Create the Aztec barcode
Dim AztecCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.Aztec)
' Display the value below the barcode
AztecCode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
AztecCode.SaveAsJpeg("aztec-sample.jpg")
Output
How do I create a DataMatrix barcode for industrial part marking?
Data Matrix is a compact 2D matrix recognized by the L-shaped finder pattern on its perimeter. This format excels where space is limited and durability is critical.
Data Matrix's unique strength is extreme durability and ability to scale down to microscopic sizes for direct part marking (DPM). It's commonly used for industrial tracking on surgical instruments, electronic components, and aerospace parts where space is severely limited. The format's compact size and high data density are perfect for creating barcodes from various data types including serial numbers and batch codes.
Code
IronBarcode makes generating DataMatrix codes simple: pass BarcodeEncoding.DataMatrix as the second parameter when calling the CreateBarcode method, then export the result as an image.
using IronBarCode;// Create the DataMatrix barcodeGeneratedBarcodeDataMatrix = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.DataMatrix);// Display the value below the barcodeDataMatrix.AddBarcodeValueTextBelowBarcode();// Save as a JPG fileDataMatrix.SaveAsJpeg("dataMatrix-sample.jpg");
using IronBarCode;
// Create the DataMatrix barcode
GeneratedBarcode DataMatrix = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.DataMatrix);
// Display the value below the barcode
DataMatrix.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
DataMatrix.SaveAsJpeg("dataMatrix-sample.jpg");
ImportsIronBarCode' Create the DataMatrix barcodeDimDataMatrixAsGeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.DataMatrix)' Display the value below the barcodeDataMatrix.AddBarcodeValueTextBelowBarcode()' Save as a JPG fileDataMatrix.SaveAsJpeg("dataMatrix-sample.jpg")
Imports IronBarCode
' Create the DataMatrix barcode
Dim DataMatrix As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.DataMatrix)
' Display the value below the barcode
DataMatrix.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
DataMatrix.SaveAsJpeg("dataMatrix-sample.jpg")
Output
How do I create a MaxiCode barcode for shipping labels?
MaxiCode is a fixed-size 2D matrix recognized by its circular bullseye pattern surrounded by a hexagonal grid. This unique design was engineered specifically for high-speed scanning on conveyor belts.
MaxiCode's unique aspect is its constant 1-inch physical size regardless of stored data, optimizing it for high-speed conveyor belt reading. It's commonly used in logistics and supply chain management, specifically on UPS shipping labels for automated package sorting and routing. The fixed size ensures consistent scanning performance regardless of data payload.
Code
IronBarcode makes generating MaxiCode simple: pass BarcodeEncoding.MaxiCode as the second parameter when calling the CreateBarcode method, then export it as an image. For more examples, check our barcode quickstart guide.
using IronBarCode;// Create the MaxiCode barcodeGeneratedBarcodeMaxiCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.MaxiCode);// Display the value below the barcodeMaxiCode.AddBarcodeValueTextBelowBarcode();// Save as a JPG fileMaxiCode.SaveAsJpeg("maxiCode-sample.jpg");
using IronBarCode;
// Create the MaxiCode barcode
GeneratedBarcode MaxiCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.MaxiCode);
// Display the value below the barcode
MaxiCode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
MaxiCode.SaveAsJpeg("maxiCode-sample.jpg");
ImportsIronBarCode' Create the MaxiCode barcodeDimMaxiCodeAsGeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.MaxiCode)' Display the value below the barcodeMaxiCode.AddBarcodeValueTextBelowBarcode()' Save as a JPG fileMaxiCode.SaveAsJpeg("maxiCode-sample.jpg")
Imports IronBarCode
' Create the MaxiCode barcode
Dim MaxiCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.MaxiCode)
' Display the value below the barcode
MaxiCode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
MaxiCode.SaveAsJpeg("maxiCode-sample.jpg")
Output
How do I create a PDF417 barcode for ID cards?
PDF417 is a stacked linear barcode recognized by its wide, rectangular appearance resembling digital static. This format encodes significantly more data than other 2D formats, making it ideal for storing detailed information.
PDF417's unique capability is serving as a portable data file, storing large amounts of data like photos, names, and biometric records without requiring database connections. It's commonly used for government identification like driver's licenses and printed airline boarding passes. The format supports both text and binary data encoding.
Code
IronBarcode makes generating PDF417 simple: pass BarcodeEncoding.PDF417 as the second parameter when calling the CreateBarcode method, then export it as an image. You can also save barcodes in various image formats including PNG, JPEG, and more.
using IronBarCode;// Create PDF417 barcodeGeneratedBarcodePDF417code = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.PDF417);// Display the value below the barcodePDF417code.AddBarcodeValueTextBelowBarcode();// Save as a JPG filePDF417code.SaveAsJpeg("pdf417-sample.jpg");
using IronBarCode;
// Create PDF417 barcode
GeneratedBarcode PDF417code = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.PDF417);
// Display the value below the barcode
PDF417code.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
PDF417code.SaveAsJpeg("pdf417-sample.jpg");
ImportsIronBarCode' Create PDF417 barcodeDimPDF417codeAsGeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.PDF417)' Display the value below the barcodePDF417code.AddBarcodeValueTextBelowBarcode()' Save as a JPG filePDF417code.SaveAsJpeg("pdf417-sample.jpg")
Imports IronBarCode
' Create PDF417 barcode
Dim PDF417code As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.PDF417)
' Display the value below the barcode
PDF417code.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
PDF417code.SaveAsJpeg("pdf417-sample.jpg")
Output
How do I create a QR Code for marketing campaigns?
A QR Code is a high-density 2D matrix recognized by three distinctive square finder patterns in its corners. As the most widely recognized 2D barcode format, QR codes have become ubiquitous in consumer applications.
QR Code's unique advantage is universal consumer accessibility - it's the only 2D symbology natively supported by virtually all modern smartphone camera apps without additional software. It's commonly used for marketing and public engagement, linking to websites and digital menus, and facilitating mobile payments. For advanced QR code generation, explore our QR code creation examples.
Code
IronBarcode makes generating QR codes simple: pass BarcodeEncoding.QRCode as the second parameter when calling the CreateBarcode method, then export it as an image. You can also customize QR code styles by adding logos and changing colors.
using IronBarCode;// Create QR CodeGeneratedBarcodeQRcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.QRCode);// Display the value below the barcodeQRcode.AddBarcodeValueTextBelowBarcode();// Save as a JPG fileQRcode.SaveAsJpeg("QRcode.jpg");
using IronBarCode;
// Create QR Code
GeneratedBarcode QRcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.QRCode);
// Display the value below the barcode
QRcode.AddBarcodeValueTextBelowBarcode();
// Save as a JPG file
QRcode.SaveAsJpeg("QRcode.jpg");
ImportsIronBarCode' Create QR CodeDimQRcodeAsGeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.QRCode)' Display the value below the barcodeQRcode.AddBarcodeValueTextBelowBarcode()' Save as a JPG fileQRcode.SaveAsJpeg("QRcode.jpg")
Imports IronBarCode
' Create QR Code
Dim QRcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.QRCode)
' Display the value below the barcode
QRcode.AddBarcodeValueTextBelowBarcode()
' Save as a JPG file
QRcode.SaveAsJpeg("QRcode.jpg")
Output
How do I create a Micro QR Code for small electronics?
A Micro QR Code is a miniaturized 2D matrix recognized by its single square finder pattern in the top-left corner. This format was designed specifically for applications where space is extremely limited.
Due to its miniaturized size, character limits apply. The largest version (M4) holds a maximum of 21 alphanumeric characters or 35 numbers. Carefully plan your data encoding strategy when using Micro QR codes.
Code
IronBarcode makes generating MicroQRCode simple: pass BarcodeEncoding.MicroQRCode as the second parameter when calling the CreateBarcode method, then export it as an image.
using IronBarCode;// Create a Micro QR CodeGeneratedBarcode microQRcode = BarcodeWriter.CreateBarcode("IRON-1234", BarcodeEncoding.MicroQRCode);// Display the value below the barcodemicroQRcode.AddBarcodeValueTextBelowBarcode();// Save to file as JpegmicroQRcode.SaveAsJpeg("microQRCode.jpg");
using IronBarCode;
// Create a Micro QR Code
GeneratedBarcode microQRcode = BarcodeWriter.CreateBarcode("IRON-1234", BarcodeEncoding.MicroQRCode);
// Display the value below the barcode
microQRcode.AddBarcodeValueTextBelowBarcode();
// Save to file as Jpeg
microQRcode.SaveAsJpeg("microQRCode.jpg");
ImportsIronBarCode' Create a Micro QR CodeDim microQRcode AsGeneratedBarcode = BarcodeWriter.CreateBarcode("IRON-1234", BarcodeEncoding.MicroQRCode)' Display the value below the barcodemicroQRcode.AddBarcodeValueTextBelowBarcode()' Save to file as JpegmicroQRcode.SaveAsJpeg("microQRCode.jpg")
Imports IronBarCode
' Create a Micro QR Code
Dim microQRcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("IRON-1234", BarcodeEncoding.MicroQRCode)
' Display the value below the barcode
microQRcode.AddBarcodeValueTextBelowBarcode()
' Save to file as Jpeg
microQRcode.SaveAsJpeg("microQRCode.jpg")
Output
What happens if my data exceeds Micro QR capacity?
IronBarcode throws an error if the input string exceeds 35 numeric digits or 21 alphanumeric characters. This built-in validation helps prevent runtime errors in production environments.
How do I create an rMQR Code for narrow spaces?
Rectangular Micro QR Code (rMQR) is a specialized 2D matrix recognized by its elongated, strip-like shape and single finder pattern in the top-left corner. This innovative format addresses a specific gap in barcode technology.
Due to its rectangular design, it stretches horizontally to increase capacity without increasing vertical footprint. The largest version (R17x139) contains up to 219 alphanumeric characters or 361 numbers - significantly more capable than MicroQRCode while maintaining a slim profile.
Code
IronBarcode makes generating RMQRCode simple: pass BarcodeEncoding.RMQRCode as the second parameter when calling the CreateBarcode method, then export it as an image. For a comprehensive overview of all IronBarcode features, visit our API reference.
using IronBarCode;// Create a RmQR CodeGeneratedBarcode rMqrCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.RMQRCode);// Display the value below the barcoderMqrCode.AddBarcodeValueTextBelowBarcode();// Save to file as JpegrMqrCode.SaveAsJpeg("rmQRcode.jpg");
using IronBarCode;
// Create a RmQR Code
GeneratedBarcode rMqrCode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.RMQRCode);
// Display the value below the barcode
rMqrCode.AddBarcodeValueTextBelowBarcode();
// Save to file as Jpeg
rMqrCode.SaveAsJpeg("rmQRcode.jpg");
ImportsIronBarCode' Create a RMQR CodeDim rMqrCode AsGeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.RMQRCode)' Display the value below the barcoderMqrCode.AddBarcodeValueTextBelowBarcode()' Save to file as JpegrMqrCode.SaveAsJpeg("rmQRcode.jpg")
Imports IronBarCode
' Create a RMQR Code
Dim rMqrCode As GeneratedBarcode = BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode/", BarcodeEncoding.RMQRCode)
' Display the value below the barcode
rMqrCode.AddBarcodeValueTextBelowBarcode()
' Save to file as Jpeg
rMqrCode.SaveAsJpeg("rmQRcode.jpg")
Output
What happens if my data exceeds rMQR capacity?
IronBarcode throws an error if the input string exceeds 361 numeric digits or 219 alphanumeric characters. This validation ensures your barcodes remain scannable and compliant with the rMQR specification.
Which 2D barcode format should I choose?
Name
Format
Common Usage
Restrictions & Pitfalls
Aztec Code
Matrix (Center-Out) Square grid with central "bullseye" finder. No quiet zone required.
Mobile boarding passes (Apple Wallet), train tickets, and healthcare wristbands.
Center Damage: Relies on center finder; bullseye damage causes total failure.
Screen Glare: Reflective phone screens can blind standard scanners.
Data Matrix
Matrix (L-Pattern) Square or rectangular with solid "L" border on two sides.
Electronics components, surgical instruments, and Direct Part Marking (DPM) on metal.
Quiet Zone: Requires 1-module white border; edge graphics cause failures.
Contrast: Shiny metal (DPM) requires specialized lighting to read.
MaxiCode
Fixed Size Matrix Exactly 1x1 inch. Hexagonal dots with central circular bullseye.
UPS Shipping labels and high-speed conveyor belt sorting.
Quiet Zone: Requires large white margin (4 modules wide).
Density: Long URLs without shortening create unfocusable "static".
Micro QR
Miniature Matrix Tiny square with only one corner finder pattern.
Printed Circuit Boards (PCBs), small electrical components.
Capacity Limit: Max ~35 numeric or 21 alphanumeric characters.
Scanner Support: Not supported by all smartphone camera apps.
rMQR
Rectangular Matrix Long, narrow strip bridging Micro QR and standard QR.
Test tubes, cables, thin bezels, narrow product edges.
New Format: Growing support but not universal on legacy scanners.
Aspect Ratio: Designed strictly for narrow spaces.
Frequently Asked Questions
What are 2D barcodes and when should I use them?
2D barcodes, like QR Codes and Data Matrix, use a grid of squares or dots to store information horizontally and vertically. These codes can store large amounts of data, such as URLs and ID details, and are highly durable due to built-in error correction. They're ideal for environments where barcodes may be scratched or damaged, or where quick scanning is necessary.
How do I create a QR Code using IronBarcode?
To create a QR Code using IronBarcode, use the `CreateBarcode` method, passing `BarcodeEncoding.QRCode` as a parameter, and export the barcode as an image with methods like `SaveAsJpeg`. IronBarcode allows you to customize the QR code by adding logos and changing colors.
Can IronBarcode generate Aztec barcodes for mobile ticketing?
Yes, IronBarcode can generate Aztec barcodes. By using the `BarcodeEncoding.Aztec` parameter in the `CreateBarcode` method, you can create this compact, space-efficient barcode, which is ideal for applications like mobile ticketing and electronic boarding passes.
What is the advantage of using Data Matrix barcodes with IronBarcode?
Data Matrix barcodes are extremely durable and can be scaled to microscopic sizes, making them ideal for industrial applications and direct part marking on electronic components. IronBarcode simplifies their creation with easy-to-use methods and options for customizing appearance.
How can I create a MaxiCode barcode with IronBarcode for logistics purposes?
To create a MaxiCode barcode with IronBarcode, pass `BarcodeEncoding.MaxiCode` to the `CreateBarcode` method. MaxiCode barcodes are optimized for high-speed scanning on logistics conveyor belts and have a fixed size, which is advantageous for automated sorting and routing.
Is IronBarcode capable of creating PDF417 barcodes for ID cards?
Yes, IronBarcode can create PDF417 barcodes, which are perfect for storing large amounts of data such as text and biometric records. Use `BarcodeEncoding.PDF417` in the `CreateBarcode` method, and export the result in various image formats for use on ID cards and licenses.
Can I generate Micro QR Codes using IronBarcode?
IronBarcode supports the generation of Micro QR Codes, which are designed for applications with limited space. Use `BarcodeEncoding.MicroQRCode` when calling `CreateBarcode`, but ensure your data doesn't exceed the character limits specific to Micro QR Codes.
What happens if my data exceeds the capacity of an rMQR Code when using IronBarcode?
IronBarcode will throw an error if the input string for an rMQR Code exceeds 361 numeric digits or 219 alphanumeric characters, ensuring your barcodes remain scannable and compliant with specifications.
How do I choose the right 2D barcode format with IronBarcode?
Choosing the right 2D barcode with IronBarcode involves understanding each format's strengths. Aztec is great for mobile screens, DataMatrix for industrial marking, QR for consumer use, and so on. IronBarcode supports all these, offering customization for specific needs.
What makes 2D barcodes generated by IronBarcode reliable?
IronBarcode equips 2D barcodes with built-in error correction, maintaining data accessibility even if the barcode is damaged. This feature, alongside the capacity to store large amounts of data, makes them reliable for fast-paced and mobile scanning environments.
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.