The fastest, most reliable .NET barcode library. Generate professional-quality barcodes in milliseconds with SkiaSharp-powered rendering.
$ dotnet add package TyKonKet.BarcodeGeneratorA compact, SkiaSharp-based .NET library for generating common 1D barcodes. Focused on reliability, correctness and a small API surface so it's easy to use from services and agent workflows.
Example:
using var barcode = new Barcode(opt => opt.Type = BarcodeTypes.Ean13);
string validated = barcode.Encode("123456789012");
barcode.Export("barcode.png");
👉 Complete Documentation - Comprehensive guides, API reference, and examples
10 industry-standard formats for every use case:
| Type | Use Case | Example |
|---|---|---|
| EAN-13 | 🛒 Retail products, European standard | 1234567890128 |
| UPC-A | 🇺🇸 North American retail, grocery | 012345678905 |
| UPC-E | 📦 Compact retail, small packages | 01234565 |
| ISBN-13 | 📚 Books and publications | 9781234567897 |
| EAN-8 | 📦 Small packages, compact spaces | 12345670 |
| CODE-39 | 🏭 Industrial, automotive, defense | ABC-123 |
| CODE-93 | 📋 Logistics, inventory management | ABC123 |
| CODE-128 | 📊 High-density alphanumeric encoding | ABC123xyz |
| CODABAR | 🏥 Libraries, blood banks, logistics | A123456A |
| ITF | 📦 Distribution, warehousing, cartons | 12345678 |
BarcodeValidator){barcode}, {format} in file namesChoose your preferred installation method:
Package Manager Console:
Install-Package TyKonKet.BarcodeGenerator
CLI Command:
dotnet add package TyKonKet.BarcodeGenerator
Get up and running in 30 seconds:
dotnet add package TyKonKet.BarcodeGenerator
using SkiaSharp;
using TyKonKet.BarcodeGenerator;
// Simple barcode generation
using var barcode = new Barcode(options => {
options.Type = BarcodeTypes.Ean13;
options.Height = 50;
options.Scaling = 3;
});
string validatedCode = barcode.Encode("123456789012");
barcode.Export("my-barcode.png");
// Advanced styling with custom colors and fonts
using var styledBarcode = new Barcode(options => {
options.Type = BarcodeTypes.Ean13;
options.ForegroundColor = SKColors.DarkBlue;
options.TextColor = SKColors.Red; // 🆕 Independent text color!
options.BackgroundColor = SKColors.LightGray;
options.UseTypeface("Arial", SKFontStyle.Bold);
options.Margins = 10;
});
string result = styledBarcode.Encode("123456789012");
styledBarcode.Export("styled-barcode.png", SKEncodedImageFormat.Png, 100);
// Dynamic file naming with placeholders
barcode.Export("output/{barcode}_{quality}.{format}", SKEncodedImageFormat.Png, 95);
// Creates: output/1234567890128_95.png
// NEW: Validate barcode data without encoding
var result = BarcodeValidator.Validate("123456789012", BarcodeTypes.Ean13);
if (result.IsValid)
{
Console.WriteLine($"✓ Valid: {result.ValidatedBarcode}");
// Output: ✓ Valid: 1234567890128 (with check digit)
}
else
{
Console.WriteLine($"✗ Errors: {string.Join(", ", result.Errors)}");
// Get suggestions for compatible barcode types (opt-in)
var resultWithSuggestions = BarcodeValidator.Validate("ABC123", BarcodeTypes.Ean13, includeSuggestions: true);
if (resultWithSuggestions.SuggestedTypes.Count > 0)
{
Console.WriteLine($"💡 Try: {string.Join(", ", resultWithSuggestions.SuggestedTypes)}");
}
}
💡 Need more help? Check out our Getting Started Guide for step-by-step tutorials and examples.
📚 Validation API: See the complete Validation API Documentation for detailed usage.
The BarcodeOptions class provides extensive customization capabilities:
| Option | Description | Default |
|---|---|---|
| Type | Barcode encoding type (EAN-13, UPC-A, ISBN-13, EAN-8, CODE-93, CODE-128) | EAN-8 |
| Height | Height of barcode bars | 30 pixels |
| Scaling | Scale factor for the entire image | 5x |
| Margins | Spacing around the barcode | 2 pixels |
| Colors | Background, foreground, and text colors (independent control) | White/Black |
| Text Rendering | Show/hide text below barcode | Enabled |
| Font Options | Custom fonts, styles, and loading methods | System default |
📚 Detailed Configuration: See our BarcodeOptions API Reference for complete documentation.
BarcodeGenerator supports multiple .NET framework versions for maximum compatibility:
| Framework | Version | Target Scenario |
|---|---|---|
| .NET Standard 2.0 | 2.0+ | Core compatibility for most scenarios |
| .NET Framework | 4.6.2+ | Legacy Windows applications |
| .NET 8.0 | 8.0+ | Long-term support version |
| .NET 10.0 | 10.0+ | Latest stable version |
PolySharp package to enhance compatibility. If you encounter any issues, please report them by opening an issue on our GitHub repository. For more details, visit the PolySharp GitHub repository.EncodesExtensions has been renamed to BarcodeTypeExtensions to better reflect its purpose. Update consuming code accordingly.net8.0/net10.0 targets; make sure callers move to those runtimes.📖 Migration Guide: See our Getting Started documentation for updated API usage patterns.
BarcodeValidator)BarcodeOptions.TextColor) and rendering improvementsHave an idea? Start a discussion or vote on features!
We welcome contributions from the community! 🎉
👉 Full Contributing Guide - Complete guide to contributing with setup, workflows, and guidelines
Quick Start:
Essential Checks:
dotnet test --configuration Release./tools/run-coverage.shEvery contribution matters - from typo fixes to new features! ✨
This library is released under the MIT License. See the LICENSE file for details.