How to Generate QR Codes

March 22, 2026 · 6 min read

QR codes are those square barcodes you see everywhere — restaurant menus, event tickets, product packaging, and marketing materials. They encode data (usually a URL) that any smartphone camera can scan instantly. Whether you need to generate one for a project, a business card, or a WiFi login, this guide covers every approach.

What Is a QR Code?

QR stands for "Quick Response." Invented in 1994 by Denso Wave for tracking automotive parts, QR codes can encode up to 4,296 alphanumeric characters. They use Reed-Solomon error correction, meaning they still work even if part of the code is damaged or obscured.

QR codes can encode several types of data:

Method 1: Use a Free Online Generator

The fastest way to create a QR code is with an online tool. No signup, no install — just paste your data and download the image.

Generate a QR Code Instantly

Enter any URL or text to generate a downloadable QR code.

Open QR Code Generator

Method 2: Generate QR Codes in JavaScript

The qrcode npm package is the most popular choice for Node.js and browser-based QR code generation.

Install

npm install qrcode

Generate in Node.js (save to file)

const QRCode = require('qrcode'); // Generate and save as PNG await QRCode.toFile('qr.png', 'https://utilshed.com', { width: 300, margin: 2, color: { dark: '#000000', light: '#ffffff' } }); // Generate as data URL (for embedding in HTML) const dataUrl = await QRCode.toDataURL('https://utilshed.com'); console.log(dataUrl); // data:image/png;base64,...

Generate in the browser

<canvas id="qr"></canvas> <script src="https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js"></script> <script> QRCode.toCanvas(document.getElementById('qr'), 'https://utilshed.com'); </script>

Method 3: Generate QR Codes in Python

pip install qrcode[pil]
import qrcode # Simple generation img = qrcode.make('https://utilshed.com') img.save('qr.png') # With customization qr = qrcode.QRCode( version=1, error_correction=qrcode.constants.ERROR_CORRECT_H, box_size=10, border=4, ) qr.add_data('https://utilshed.com') qr.make(fit=True) img = qr.make_image(fill_color='black', back_color='white') img.save('qr_custom.png')

The error_correction parameter controls how much of the QR code can be damaged and still scan:

Method 4: Command Line

Generate QR codes directly from the terminal:

# Using qrencode (Linux/macOS) sudo apt install qrencode # Debian/Ubuntu brew install qrencode # macOS qrencode -o qr.png 'https://utilshed.com' qrencode -t UTF8 'https://utilshed.com' # Print to terminal

Method 5: Using a QR Code API

If you need to generate QR codes dynamically without installing anything, use a public API:

# Google Charts API (simple, no auth needed) https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=https://utilshed.com # Or use curl to download curl -o qr.png "https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl=https://utilshed.com"

WiFi QR Codes

One of the most practical QR code use cases — let guests connect to your WiFi by scanning a code instead of typing the password:

# WiFi QR code format WIFI:T:WPA;S:MyNetworkName;P:MyPassword;; # For open networks (no password) WIFI:T:nopass;S:MyNetworkName;; # For WEP (legacy) WIFI:T:WEP;S:MyNetworkName;P:MyPassword;;

Paste the WiFi string into any QR code generator and share the resulting image. Most modern phones will auto-detect the WiFi format and offer to connect.

Best Practices

Try It Now

Need a QR code right now? Use the free QR Code Generator on UtilShed — paste any URL or text, customize the size, and download instantly.

Related tools you might find useful: