QRCoder 1.7.0
dotnet add package QRCoder --version 1.7.0
NuGet\Install-Package QRCoder -Version 1.7.0
<PackageReference Include="QRCoder" Version="1.7.0" />
<PackageVersion Include="QRCoder" Version="1.7.0" />
<PackageReference Include="QRCoder" />
paket add QRCoder --version 1.7.0
#r "nuget: QRCoder, 1.7.0"
#:package QRCoder@1.7.0
#addin nuget:?package=QRCoder&version=1.7.0
#tool nuget:?package=QRCoder&version=1.7.0
QRCoder
QRCoder is a simple C# library originally created by Raffael Herrmann for generating QR codes and Micro QR codes.
✨ Features
- 🚀 Zero dependencies - No external libraries required (framework dependencies only)
- ⚡ Fast performance - Optimized QR code generation with low memory footprint
- 🎨 Multiple output formats - PNG, SVG, PDF, ASCII, Bitmap, PostScript, and more
- 📱 23+ payload generators - WiFi, vCard, URLs, payments, and many more
- 🔧 Highly configurable - Error correction levels, custom colors, logos, and styling
- 🌐 Cross-platform - Supports .NET 5+, .NET Framework 3.5+, .NET Core 1.0+, and .NET Standard 1.3+
- 📦 Micro QR codes - Smaller QR codes for space-constrained applications
📦 Installation
Install via NuGet Package Manager:
PM> Install-Package QRCoder
🚀 Quick Start
Generate a QR code with just a few lines of code, either using a renderer's static helper method, or by creating a QR code first and then passing it to a renderer:
using QRCoder;
// Generate a simple black and white PNG QR code
byte[] qrCodeImage = PngByteQRCodeHelper.GetQRCode("Hello World", QRCodeGenerator.ECCLevel.Q, 20);
// Generate a scalable black and white SVG QR code
using var qrCodeData = QRCodeGenerator.GenerateQrCode("Hello World", QRCodeGenerator.ECCLevel.Q);
using var svgRenderer = new SvgQRCode(qrCodeData);
string svg = svgRenderer.GetGraphic();
For more examples and detailed usage instructions, see: Wiki: How to use QRCoder
📱 Payload Generators
QR codes can encode structured data that triggers specific actions when scanned (e.g., WiFi credentials, contact information, URLs). QRCoder includes payload generators that create properly formatted strings for these common use cases.
Usage Example
using QRCoder;
// Create a bookmark payload
var bookmarkPayload = new PayloadGenerator.Bookmark("https://github.com/Shane32/QRCoder", "QRCoder Repository");
// Generate the QR code data from the payload
using var qrCodeData = QRCodeGenerator.GenerateQrCode(bookmarkPayload);
// Or override the ECC level
using var qrCodeData2 = QRCodeGenerator.GenerateQrCode(bookmarkPayload, QRCodeGenerator.ECCLevel.H);
// Render the QR code
using var pngRenderer = new PngByteQRCode(qrCodeData);
byte[] qrCodeImage = pngRenderer.GetGraphic(20);
Available Payload Types
Payload Type | Usage Example | Description |
---|---|---|
WiFi | new PayloadGenerator.WiFi(ssid, password, auth) |
WiFi network credentials |
URL | new PayloadGenerator.Url("https://example.com") |
Website URL |
Bookmark | new PayloadGenerator.Bookmark(url, title) |
Browser bookmark |
new PayloadGenerator.Mail(email, subject, body) |
Email with pre-filled fields | |
SMS | new PayloadGenerator.SMS(number, message) |
SMS message |
MMS | new PayloadGenerator.MMS(number, subject) |
MMS message |
Geolocation | new PayloadGenerator.Geolocation(lat, lng) |
GPS coordinates |
PhoneNumber | new PayloadGenerator.PhoneNumber(number) |
Phone number for calling |
SkypeCall | new PayloadGenerator.SkypeCall(username) |
Skype call |
WhatsAppMessage | new PayloadGenerator.WhatsAppMessage(number, msg) |
WhatsApp message |
ContactData | new PayloadGenerator.ContactData(...) |
vCard/MeCard contact |
CalendarEvent | new PayloadGenerator.CalendarEvent(...) |
iCal/vEvent |
OneTimePassword | new PayloadGenerator.OneTimePassword(...) |
TOTP/HOTP for 2FA |
BitcoinAddress | new PayloadGenerator.BitcoinAddress(address) |
Bitcoin payment |
BitcoinCashAddress | new PayloadGenerator.BitcoinCashAddress(address) |
Bitcoin Cash payment |
LitecoinAddress | new PayloadGenerator.LitecoinAddress(address) |
Litecoin payment |
MoneroTransaction | new PayloadGenerator.MoneroTransaction(...) |
Monero payment |
SwissQrCode | new PayloadGenerator.SwissQrCode(...) |
Swiss QR bill (ISO-20022) |
Girocode | new PayloadGenerator.Girocode(...) |
SEPA payment (EPC QR) |
BezahlCode | new PayloadGenerator.BezahlCode(...) |
German payment code |
RussiaPaymentOrder | new PayloadGenerator.RussiaPaymentOrder(...) |
Russian payment (ГОСТ Р 56042-2014) |
SlovenianUpnQr | new PayloadGenerator.SlovenianUpnQr(...) |
Slovenian UPN payment |
ShadowSocksConfig | new PayloadGenerator.ShadowSocksConfig(...) |
Shadowsocks proxy config |
For detailed information about payload generators, see: Wiki: Advanced usage - Payload generators
🎨 QR Code Renderers
QRCoder provides multiple renderers for different output formats and use cases. Each renderer has specific capabilities and framework requirements.
Renderer | Output Format | Requires | Usage Example |
---|---|---|---|
PngByteQRCode | PNG byte array | — | new PngByteQRCode(data).GetGraphic(20) |
SvgQRCode | SVG string | — | new SvgQRCode(data).GetGraphic(20) |
QRCode | System.Drawing.Bitmap | Windows¹ | new QRCode(data).GetGraphic(20) |
ArtQRCode | Artistic bitmap with custom images | Windows¹ | new ArtQRCode(data).GetGraphic(20) |
AsciiQRCode | ASCII art string | — | new AsciiQRCode(data).GetGraphic(1) <br/>new AsciiQRCode(data).GetGraphicSmall() |
Base64QRCode | Base64 encoded image | — | new Base64QRCode(data).GetGraphic(20) |
BitmapByteQRCode | BMP byte array | — | new BitmapByteQRCode(data).GetGraphic(20) |
PdfByteQRCode | PDF byte array | — | new PdfByteQRCode(data).GetGraphic(20) |
PostscriptQRCode | PostScript/EPS string | — | new PostscriptQRCode(data).GetGraphic(20) |
XamlQRCode | XAML DrawingImage | XAML² | new XamlQRCode(data).GetGraphic(20) |
UnityQRCode | Unity Texture2D | Unity³ | new UnityQRCode(data).GetGraphic(20) |
Notes:
- ¹ Requires Windows or System.Drawing.Common package (uses GDI+)
- ² Requires the QRCoder.Xaml package
- ³ Requires the QRCoder.Unity package
Framework Compatibility: Not all renderers are available on all target frameworks. Check the compatibility table for details.
For comprehensive information about renderers, see: Wiki: Advanced usage - QR Code renderers
🔧 Advanced Features
Micro QR Codes
QRCoder supports Micro QR codes, which are smaller versions of standard QR codes suitable for applications with limited space. Micro QR codes have significantly limited storage capacity—as few as 5 numeric digits (M1) or as many as 35 numeric digits (M4), with alphanumeric and byte data storing considerably less.
using QRCoder;
// Generate a Micro QR code (versions M1-M4, represented as -1 to -4)
using var qrCodeData = QRCodeGenerator.GenerateMicroQrCode("Hello", QRCodeGenerator.ECCLevel.L, requestedVersion: -2);
using var qrCode = new PngByteQRCode(qrCodeData);
byte[] qrCodeImage = qrCode.GetGraphic(20);
Note: Micro QR codes have limitations on data capacity and error correction levels. They support versions M1 through M4 (specified as -1 to -4), and not all ECC levels are available for all versions. M1 only supports detection (no ECC), M2 and M3 support L and M levels, and M4 supports L, M, and Q levels. For detailed capacity tables, see the Micro QR Code specification.
Working with QRCodeData
QRCodeData
is the core data structure that represents a QR code's module matrix. It contains a List<BitArray>
called ModuleMatrix
, where each BitArray
represents a row of modules in the QR code. A module is set to true
for dark/black modules and false
for light/white modules.
You can access the ModuleMatrix
directly to read or manipulate the QR code data at the module level. This is useful for custom rendering implementations or analyzing QR code structure.
using QRCoder;
// Generate QR code data
using var qrCodeData = QRCodeGenerator.GenerateQrCode("Hello World", QRCodeGenerator.ECCLevel.Q);
// Access the module matrix
var moduleMatrix = qrCodeData.ModuleMatrix;
int size = moduleMatrix.Count; // Size of the QR code (includes quiet zone)
// Manually render as ASCII (versus the included ASCII renderer)
for (int y = 0; y < size; y++)
{
for (int x = 0; x < size; x++)
{
// Check if module is dark (true) or light (false)
bool isDark = moduleMatrix[y][x];
Console.Write(isDark ? "██" : " ");
}
Console.WriteLine();
}
🚀 CI Builds
The NuGet feed contains only major/stable releases. If you want the latest functions and features, you can use the CI builds via Github packages.
(More information on how to use Github Packages in Nuget Package Manager can be found here.)
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
📄 License
QRCoder is a project originally by Raffael Herrmann and was first released in 10/2013. It's licensed under the MIT license.
Since 2025, QRCoder has been maintained by Shane32 with contributions from the community.
🙏 Credits
Glory to Jehovah, Lord of Lords and King of Kings, creator of Heaven and Earth, who through his Son Jesus Christ, has redeemed me to become a child of God. -Shane32
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.3 is compatible. netstandard1.4 was computed. netstandard1.5 was computed. netstandard1.6 was computed. netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Universal Windows Platform | uap was computed. uap10.0 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 1.3
- NETStandard.Library (>= 1.6.1)
- System.Text.Encoding.CodePages (>= 5.0.0)
-
.NETStandard 2.0
- System.Drawing.Common (>= 5.0.3)
- System.Text.Encoding.CodePages (>= 5.0.0)
-
.NETStandard 2.1
- System.Drawing.Common (>= 5.0.3)
- System.Text.Encoding.CodePages (>= 5.0.0)
-
net5.0
- System.Drawing.Common (>= 5.0.3)
-
net6.0
- System.Drawing.Common (>= 6.0.0)
NuGet packages (406)
Showing the top 5 NuGet packages that depend on QRCoder:
Package | Downloads |
---|---|
GoogleAuthenticator
Google Authenticator Two-Factor Authentication Library (Not officially affiliated with Google.) |
|
FenixAlliance.ACL.Dependencies
Application Component for the Alliance Business Suite. |
|
2AxisTechnology.Core.CL
Plz don't install. |
|
LJH.BO.Abstractions
1、基础数据操作通用抽象库 2、.netore升级到3.1 2、补充nodejs 等操作 3、添加缓存ICacheMapperDbProvider, 处理文件缓存导致文件拒绝访问问题 |
|
TwoFactorAuth.Net.QRCoder
QR code provider for TwoFactorAuth.Net using the excellent QRCoder library (https://github.com/codebude/QRCoder/) |
GitHub repositories (72)
Showing the top 20 popular GitHub repositories that depend on QRCoder:
Repository | Stars |
---|---|
2dust/v2rayN
A GUI client for Windows, Linux and macOS, support Xray and sing-box and others
|
|
nilaoda/BBDown
Bilibili Downloader. 一个命令行式哔哩哔哩下载器.
|
|
Richasy/Bili.Uwp
适用于新系统UI的哔哩
|
|
RayWangQvQ/BiliBiliToolPro
B 站(bilibili)自动任务工具,支持docker、青龙、k8s等多种部署方式。敏感肌也能用。
|
|
btcpayserver/btcpayserver
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
|
|
proxysu/ProxySU
Xray,V2ray,Trojan,NaiveProxy, Trojan-Go, ShadowsocksR(SSR),Shadowsocks-libev及相关插件,MTProto+TLS 一键安装工具,windows下用(一键科学上网)
|
|
yaobiao131/downkyicore
哔哩下载姬(跨平台版)downkyi,哔哩哔哩网站视频下载工具,支持批量下载,支持8K、HDR、杜比视界,提供工具箱(音视频提取、去水印等)。
|
|
DGP-Studio/Snap.Hutao
实用的开源多功能原神工具箱 🧰 / Multifunctional Open-source Genshin Impact Toolkit 🧰
|
|
immense/Remotely
A remote control and remote scripting solution, built with .NET 8, Blazor, and SignalR.
|
|
kwsch/PKHeX
Pokémon Save File Editor
|
|
stratumauth/app
📱 Two-Factor Authentication (2FA) client for Android + Wear OS
|
|
SteamRE/SteamKit
SteamKit2 is a .NET library designed to interoperate with Valve's Steam network. It aims to provide a simple, yet extensible, interface to perform various actions on the network.
|
|
SteamRE/DepotDownloader
Steam depot downloader utilizing the SteamKit2 library.
|
|
Coolapk-UWP/Coolapk-UWP
一个基于 UWP 平台的第三方酷安客户端
|
|
Nethereum/Nethereum
Ethereum .Net cross platform integration library
|
|
Uotan-Dev/UotanToolboxNT
现代化 Android & OpenHarmony 工具箱 | A Modern Toolbox for Android & OpenHarmony Devices
|
|
Nexus-Mods/NexusMods.App
Home of the development of the Nexus Mods App
|
|
real-zony/ZonyLrcToolsX
ZonyLrcToolsX 是一个能够方便地下载歌词的小软件。
|
|
Paving-Base/APK-Installer
An Android Application Installer for Windows
|
|
HyPlayer/HyPlayer
仅供学习交流使用 | 第三方网易云音乐播放器 | A Netease Cloud Music Player
|
Version | Downloads | Last Updated |
---|---|---|
1.7.0 | 13,673 | 10/9/2025 |
1.6.0 | 6,355,426 | 6/30/2024 |
1.5.1 | 1,294,389 | 4/27/2024 |
1.5.0 | 11,482 | 4/26/2024 |
1.4.3 | 19,071,387 | 12/12/2021 |
1.4.2 | 2,032,841 | 11/23/2021 |
1.4.1 | 7,387,960 | 11/17/2020 |
1.3.9 | 4,255,747 | 4/8/2020 |
1.3.7 | 14,219 | 4/7/2020 |
1.3.6 | 3,169,499 | 6/25/2019 |
1.3.5 | 2,803,554 | 11/23/2018 |
1.3.4 | 162,360 | 11/17/2018 |
1.3.3 | 928,578 | 4/22/2018 |
1.3.2 | 773,526 | 10/21/2017 |
1.3.1 | 21,619 | 10/3/2017 |
1.3.0 | 112,742 | 9/23/2017 |
1.2.9 | 190,252 | 6/15/2017 |
1.2.8 | 35,318 | 5/18/2017 |
1.2.7 | 28,689 | 4/30/2017 |
1.2.6 | 75,004 | 3/16/2017 |
1.2.5 | 88,585 | 1/28/2017 |
1.2.4 | 3,675 | 1/26/2017 |
1.2.3 | 34,829 | 12/10/2016 |
1.2.2 | 46,986 | 9/13/2016 |
1.2.1 | 3,186 | 9/10/2016 |
1.2.0 | 13,796 | 9/8/2016 |
1.1.9 | 23,414 | 7/7/2016 |
1.1.8 | 3,462 | 6/27/2016 |
1.1.7 | 109,571 | 5/18/2016 |
1.1.6 | 3,210 | 5/18/2016 |
1.1.5 | 21,338 | 5/16/2016 |