How to create (encode) and decode QR code?

Generating QR codes and decoding them are not supported by .NET natively, so we have to use some 3rd party library.

I chose a very simple-to-use one from NuGet: MessagingToolkit.QRCode

I’ve created a new WinForms application, added this package to the project with this form:

Only those 2 buttons have event subscription: to Click event:

Now, that’s all. Type any text into the first textbox, click on Encode, save the QR Code as a jpg file, then click on decode button, browse for this QR Code jpg file and you’ll see it decoded.