![]() |
VOOZH | about |
dotnet add package QRCoder --version 1.8.0
NuGet\Install-Package QRCoder -Version 1.8.0
<PackageReference Include="QRCoder" Version="1.8.0" />
<PackageVersion Include="QRCoder" Version="1.8.0" />Directory.Packages.props
<PackageReference Include="QRCoder" />Project file
paket add QRCoder --version 1.8.0
#r "nuget: QRCoder, 1.8.0"
#:package QRCoder@1.8.0
#addin nuget:?package=QRCoder&version=1.8.0Install as a Cake Addin
#tool nuget:?package=QRCoder&version=1.8.0Install as a Cake Tool
👁 NuGet
👁 Nuget
👁 Coverage
👁 GitHub contributors
QRCoder is a simple C# library originally created by Raffael Herrmann for generating QR codes and Micro QR codes.
Install via NuGet Package Manager:
PM> Install-Package QRCoder
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
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.
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);
| 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
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) or 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:
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
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.
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();
}
The QRCode and ArtQRCode renderers depend on System.Drawing.Common, which Microsoft has removed cross-platform support for in .NET 6+. You may encounter one of the following build or runtime errors:
CA1416: This call site is reachable on all platforms. 'QRCode.QRCode(QRCodeData)' is only supported on: 'windows'
System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
System.PlatformNotSupportedException: System.Drawing.Common is not supported on this platform.
Solutions include:
<TargetFramework>net8.0-windows</TargetFramework>[SupportedOSPlatform("windows")] attribute#if WINDOWS or if (OperatingSystem.IsWindows())PngByteQRCode, SvgQRCode, or BitmapByteQRCodeISO-8859-2 encoding is not natively supported on .NET Core and .NET 5+. If you need to use ISO-8859-2 encoding in your code, you must:
System.Text.Encoding.CodePages NuGet packageusing System.Text;
// Register the code pages encoding provider
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Note that the RussiaPaymentOrder payload generator already includes this registration internally, so no additional setup is required when using that class.
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.)
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.
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.
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 net5.0 is compatible. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp1.0 netcoreapp1.0 was computed. netcoreapp1.1 netcoreapp1.1 was computed. netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard1.3 netstandard1.3 is compatible. netstandard1.4 netstandard1.4 was computed. netstandard1.5 netstandard1.5 was computed. netstandard1.6 netstandard1.6 was computed. netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net35 net35 is compatible. net40 net40 is compatible. net403 net403 was computed. net45 net45 was computed. net451 net451 was computed. net452 net452 was computed. net46 net46 was computed. net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen30 tizen30 was computed. tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Universal Windows Platform | uap uap was computed. uap10.0 uap10.0 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
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. |
|
|
CxCore
Package Description |
|
|
TwoFactorAuth.Net.QRCoder
QR code provider for TwoFactorAuth.Net using the excellent QRCoder library (https://github.com/codebude/QRCoder/) |
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. 一个命令行式哔哩哔哩下载器.
|
|
|
TechnitiumSoftware/DnsServer
Technitium DNS Server
|
|
|
RayWangQvQ/BiliBiliToolPro
B 站(bilibili)自动任务工具,支持docker、青龙、k8s等多种部署方式。全面拥抱AI。敏感肌也能用。
|
|
|
Richasy/Bili.Uwp
适用于新系统UI的哔哩
|
|
|
btcpayserver/btcpayserver
Accept Bitcoin payments. Free, open-source & self-hosted, Bitcoin payment processor.
|
|
|
yaobiao131/downkyicore
哔哩下载姬(跨平台版)downkyi,哔哩哔哩网站视频下载工具,支持批量下载,支持8K、HDR、杜比视界,提供工具箱(音视频提取、去水印等)。
|
|
|
proxysu/ProxySU
Xray,V2ray,Trojan,NaiveProxy, Trojan-Go, ShadowsocksR(SSR),Shadowsocks-libev及相关插件,MTProto+TLS 一键安装工具,windows下用(一键科学上网)
|
|
|
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/DepotDownloader
Steam depot downloader utilizing the SteamKit2 library.
|
|
|
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.
|
|
|
Coolapk-UWP/Coolapk-UWP
一个基于 UWP 平台的第三方酷安客户端
|
|
|
Uotan-Dev/UotanToolboxNT
现代化 Android & OpenHarmony 工具箱 | A Modern Toolbox for Android & OpenHarmony Devices
|
|
|
shrimqy/Sefirah
Phone Link / KDE Connect alternative
|
|
|
Nethereum/Nethereum
Ethereum .Net cross platform integration library
|
|
|
Nexus-Mods/NexusMods.App
Home of the development of the Nexus Mods App
|
|
|
jayfunc/BetterLyrics
An elegant and deeply customizable lyrics visualizer & versatile music player, built with WinUI3/Win2D | 一款优雅且高度自定义的歌词可视化与全能音乐播放应用,基于 WinUI3/Win2D 构建
|
|
|
s1t5/mail-archiver
Mail-Archiver is a web application for archiving, searching, and exporting emails from multiple accounts. Featuring folder sync, attachment support, mailbox migration and a dashboard.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.8.0 | 1,113,289 | 4/4/2026 |
| 1.7.0 | 3,850,619 | 10/9/2025 |
| 1.6.0 | 12,511,508 | 6/30/2024 |
| 1.5.1 | 1,743,469 | 4/27/2024 |
| 1.5.0 | 37,458 | 4/26/2024 |
| 1.4.3 | 23,751,313 | 12/12/2021 |
| 1.4.2 | 2,359,071 | 11/23/2021 |
| 1.4.1 | 8,164,455 | 11/17/2020 |
| 1.3.9 | 4,694,844 | 4/8/2020 |
| 1.3.7 | 33,993 | 4/7/2020 |
| 1.3.6 | 3,457,488 | 6/25/2019 |
| 1.3.5 | 3,116,327 | 11/23/2018 |
| 1.3.4 | 192,006 | 11/17/2018 |
| 1.3.3 | 979,445 | 4/22/2018 |
| 1.3.2 | 836,076 | 10/21/2017 |
| 1.3.1 | 39,432 | 10/3/2017 |
| 1.3.0 | 153,002 | 9/23/2017 |
| 1.2.9 | 215,410 | 6/15/2017 |
| 1.2.8 | 52,266 | 5/18/2017 |
| 1.2.7 | 45,396 | 4/30/2017 |