The Shack Tool Guides QR Codes for Developers

QR Codes for Developers: When, Why, and How to Generate Them

Back to All Posts

QR codes had a moment during the pandemic when every restaurant table sprouted one, but for developers they've always been a genuinely useful tool — a fast, reliable way to get data from a screen into a phone without typing. If you've only thought of them as menu replacements, there's a lot more they can do in a development context.

Generate one instantly with the DevToolShack QR Code Generator — any URL, text, or data, free in your browser, downloadable as PNG or SVG.

How QR Codes Actually Work

A QR code (Quick Response code) is a two-dimensional barcode that encodes data as a pattern of black and white squares. Unlike a 1D barcode that can only hold ~20 numbers, a QR code can hold up to 4,296 alphanumeric characters or 7,089 numeric digits.

The key structural elements:

  • Finder patterns — the three squares in the corners that help scanners locate and orient the code
  • Data modules — the grid of squares encoding the actual content
  • Error correction — built-in redundancy so codes still scan even if damaged or partially obscured

QR codes support four error correction levels — L (7%), M (15%), Q (25%), and H (30%) — indicating how much of the code can be damaged and still be read. Higher correction means more redundant data, which means a slightly larger or denser code.

Developer Use Cases

App Store Links

Instead of asking users to search the App Store or Play Store by name, encode your app's direct URL in a QR code for print materials, presentations, or packaging. A single scan takes them straight to the install page.

Local Development URL Sharing

Running a dev server on your laptop and want to test on your phone? Generate a QR code for your local network URL (http://192.168.1.x:3000) and scan it — no typing a tricky IP address on a mobile keyboard.

Local dev shortcut: Open the QR Generator, paste your http://192.168.x.x:PORT address, scan with your phone. Instant mobile browser test without typing an IP address. One of those small quality-of-life improvements that adds up over hundreds of dev sessions.

Wi-Fi Credentials

QR codes support a special Wi-Fi format that lets phones join a network by scanning — no password entry required. The format is:

WIFI:T:WPA;S:NetworkName;P:Password;;

Encode this string as a QR code and any modern smartphone camera will offer to join the network automatically. Great for office guest networks, events, or client setups.

Two-Factor Authentication (TOTP Setup)

When implementing TOTP-based 2FA in your app, you present the user with a QR code encoding an otpauth:// URI that authenticator apps (Google Authenticator, Authy) can scan directly:

otpauth://totp/AppName:user@example.com?secret=BASE32SECRET&issuer=AppName

This is the standard way to set up 2FA — scanning the QR code is far more reliable than manually typing a 32-character base32 secret.

vCard / Contact Sharing

Encode a vCard string in a QR code and anyone who scans it gets a ready-to-save contact — name, phone, email, website. Useful for business cards, conference badges, or anywhere you'd hand out contact details.

Deep Links

If your mobile app supports deep linking, QR codes are a clean way to trigger specific in-app actions from physical or digital contexts — opening a specific product page, starting an onboarding flow, or pre-filling a form.

QR Code Size and Quality Guidelines

Use CaseMinimum SizeError Correction
On-screen display200×200pxM (15%)
Print (business card)2cm × 2cmM or Q
Print (poster/signage)5cm × 5cmQ (25%)
Outdoor/weathered10cm × 10cmH (30%)
With logo overlayAnyH (30%) required

Generating QR Codes in Code

For server-side generation, there are solid libraries for every major language:

// Node.js — qrcode library
import QRCode from 'qrcode';

// Generate as data URL (for embedding in HTML)
const dataUrl = await QRCode.toDataURL('https://devtoolshack.com');

// Generate as SVG string
const svg = await QRCode.toString('https://devtoolshack.com', { type: 'svg' });

// Save to file
await QRCode.toFile('qr.png', 'https://devtoolshack.com', {
  errorCorrectionLevel: 'H',
  width: 400
});
# Python — qrcode library
import qrcode

qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)
qr.add_data('https://devtoolshack.com')
qr.make(fit=True)

img = qr.make_image(fill_color='black', back_color='white')
img.save('qr.png')
For one-off QR codes — sharing a URL, testing a link, creating a Wi-Fi code — the QR Code Generator is faster than setting up a library. For dynamic or bulk generation (unique codes per user, per product), a server-side library is the right tool.