How to Easily Create QR Codes on Linux


A QR code is a type of barcode that stores information and is read using a digital device, including smartphones. If you’ve been to convenience stores or cafes, you’ve probably seen QR codes there for receiving payments or sharing Wi-Fi passwords, among other things.

But that’s not all. QR codes have other useful applications in today’s world. For example, you can use QR codes to share access to your home Wi-Fi with guests or to share your contact card.

Follow along as we explain how to create QR codes on Linux using qrencode.

Step 1: Install qrencode on Linux

First, you need to install the qrencode program on your computer. Like any other program, doing this on your Linux machine completely depends on the Linux distribution you are using. So follow the steps below accordingly to get qrencode on your system:

On Ubuntu and its derivatives, open the terminal and run the following command to install qrencode:

sudo apt install qrencode

To install qrencode on Fedora, use:

sudo dnf install qrencode

On Arch Linux and Manjaro, you can install qrencode with Pacman, like this:

sudo pacman -S qrencode

If you are on openSUSE, run:

sudo zypper install qrencode


Step 2: Use qrencode to create a QR code

Being a CLI-based tool, qrencode involves using a bunch of different options to generate a QR code. Here are all the essential options (and their attributes) you need to know to generate a basic QR code:

  • -o filename: Used to specify the output file name of the generated QR code.
  • -cut : It allows you to specify the module size in points. By default, its value is set to three, but you can change it according to your needs.
  • -l error_correction_level: As the name suggests, this option allows you to set the error correction level of your QR code. Basically, it decides the amount of change in the QR code that affects its scannability. It uses low (L) by default.
  • -t file type: This option allows you to decide the file type for your QR code. Its default is PNG, but you can set it to a range of other formats.

For more qrencode options, run the following command in a terminal window:


Now that you’re familiar with the basic qrencode options, here’s how to put them together in a command to generate a QR code that generates text:

qrencode -s 9 -l H -o "QR-code.png" "This is a test QR code!"

With this command we generate a QR code for the text “This is a test QR code!”. This QR code will be called QR-code.png, are nine pixels in size and use the high (H) correction level. It will be saved in your computer’s home directory, so you can use the built-in file manager to access it.

Step 3: Verification of the generated QR code

After creating the QR code, the next step is to check if it was generated correctly and if it contains the desired information.

To do this, all you need is a QR code scanner. On iPhone, you get a QR scanner as an inbuilt utility, which you can access from the control center. On the other hand, if you are on Android, you can download Kaspersky’s QR Code Reader and Scanner on your device. Or you can download any other QR code scanner from play store.

To download: QR Code Reader & Scanner by Kaspersky

Next, open the QR code image on your Linux desktop. Launch the QR code scanner on your smartphone and point it at the QR code on your computer so it lines up properly inside the box.

Once your phone scans this code, it will display its contents. Check if it is the same content that you inserted when generating the code. In case it is the same, you are good to go and can use this QR code as you wish. If not, try generating it again using qrencode.

Encode other data types in a QR code

As mentioned a few steps earlier, text is one of the many types of data you can encode in your QR code. Besides text, you can also include a website URL, SMS or email link to your phone number or email address, contact card, app download links, or event of calendar, among others.

Below we have listed the commands to generate QR codes with a few of these elements:

1. Generate QR Code with Website URL

qrencode -s 9 -l H -o "URL.png" ""

2. Add SMS Prompt to QR Code

qrencode -s 9 -l H -o "SMS.png" "SMSTO:+XX-XXXXXXXXXX:Hi"

When you scan this QR code using your phone, it prompts you to send the message or compose a new one in the messaging app. Selecting the former will send a “Hi” message to that number, while the latter will give you the option to edit the message before sending it.

Alternatively, you can also leave the space after the Colon (:) in the empty command to give the person scanning the code the option to enter whatever text they want.

3. Encode a contact card into a QR code

Since a contact card usually contains a bunch of information that spans multiple lines, adding those lines of text to your QR code when generating it is not a wise move. So instead, what you need to do is add them to a text file and pipe qrencode to it, like this:

qrencode -s 9 -l H -o "contact_card.png" < vcard.txt

Essential fields in the contact card for your reference:


5. Share Wi-Fi details via QR code

qrencode -s 9 -l H -o "WiFi-details.png" "WIFI:S:<SSID>;T:WPA2;P:<password>;;"

Here, replace and with your Wi-Fi name and password respectively. Also, if your network uses WEP instead of WPA, replace WPA with the same.

Now, as soon as you scan this code on your phone, it will ask you to connect to the network. Press on Rejoin, Relateor any other equivalent button to connect to it instantly.

6. Create a QR code with an email prompt

qrencode -s 9 -l H -o "email.png" "mailto:<email_address>?subject=Subject&body=Body"

In the command above, replace with the email address you want people scanning the QR code to contact you at. And similarly, replace Matter and Body according to your requirements.

7. Add WhatsApp message prompt in QR code

qrencode -s 9 -l H -o "WhatsApp-Me.png" ""

When you run this command, replace all X’s with your mobile number (including country code).

Easily Generate Custom QR Codes on Linux

Generating QR codes may seem quite a difficult task at first. However, using the right QR code generator tool can make the process much easier, as shown in this guide using the qrencode generator.

So now you can easily create QR codes to share your contact card, send calendar invitations, share Wi-Fi credentials and much more. Of course, we’ve listed the codes for a few of these apps, and you can do a whole lot more just by searching Google.

If you’re looking for a permanent solution, you can even create a 3D printed QR code yourself.

qr codes

What is a QR Code and how to 3D print one?

Read more


Comments are closed.