QR codes are everywhere — on restaurant menus, product packaging, business cards, event tickets, and billboard advertisements. What started as a niche inventory tracking tool in Japanese auto manufacturing has become one of the most versatile data-encoding technologies in everyday life.
Whether you're a developer integrating QR codes into an application, a marketer running a campaign, or a small business owner wanting to share your WiFi password, this guide covers everything you need to know about creating QR codes — from the underlying technology to practical step-by-step tutorials and best practices.
Ready to jump straight in? Use our free QR Code Generator to create a QR code in seconds — no sign-up required.
What Are QR Codes?
QR stands for "Quick Response." A QR code is a two-dimensional matrix barcode that stores data in a grid of black and white squares (called "modules"). Unlike traditional one-dimensional barcodes that can only hold around 20 characters, QR codes can encode up to 7,089 numeric characters or 4,296 alphanumeric characters.
QR codes are designed to be read quickly by optical scanners, including the cameras on modern smartphones. The data is encoded redundantly, which means QR codes can still be read even when partially damaged or obscured — a property known as error correction.
Anatomy of a QR Code
Every QR code contains several structural elements:
- Finder patterns — The three large squares in the corners that help scanners locate and orient the code, regardless of the scanning angle.
- Alignment patterns — Smaller squares that help correct distortion when the code is printed on curved surfaces or photographed at an angle.
- Timing patterns — Alternating black and white modules between finder patterns that help the scanner determine module size and count.
- Format information — Data near the finder patterns that tells the scanner which error correction level and mask pattern is used.
- Data and error correction modules — The remaining area that contains the actual encoded data plus Reed-Solomon error correction codewords.
- Quiet zone — A mandatory white border (at least 4 modules wide) surrounding the code that separates it from its environment.
A Brief History of QR Codes
QR codes were invented in 1994 by Masahiro Hara and his team at Denso Wave, a subsidiary of Toyota. The original purpose was to track automotive parts during manufacturing — traditional barcodes were too limited in capacity and too slow to scan.
Denso Wave made a pivotal decision: they released the QR code specification publicly and chose not to enforce their patent rights. This open approach allowed QR codes to spread globally without licensing barriers.
Key milestones in QR code adoption:
- 1994 — QR code invented by Denso Wave for Toyota supply chain tracking.
- 2000 — QR code approved as an ISO international standard (ISO/IEC 18004).
- 2002 — First mobile phones with built-in QR readers launched in Japan.
- 2010 — QR codes gain traction in Western marketing and advertising.
- 2017 — Apple's iOS 11 adds native QR code scanning to the Camera app, eliminating the need for third-party apps.
- 2020 — COVID-19 pandemic accelerates QR code adoption for contactless menus, check-ins, and digital health passes.
- 2022+ — QR codes become standard for mobile payments, digital tickets, and augmented reality experiences.
How QR Code Encoding Works
Understanding the encoding process helps you make better decisions about QR code content and size. Here's a simplified overview of how data becomes a QR code:
Step 1: Data Analysis
The encoder first analyzes the input data to determine the most efficient encoding mode:
- Numeric mode — Digits 0-9 only. Most compact: 3.3 bits per character.
-
Alphanumeric mode — Digits, uppercase A-Z, and nine special characters (
$ % * + - . / : space). About 5.5 bits per character. - Byte mode — Any 8-bit byte value, typically used for UTF-8 text and URLs. 8 bits per character.
- Kanji mode — Double-byte characters from the Shift JIS encoding. 13 bits per character.
A single QR code can mix modes within the same symbol. For example, a URL might use alphanumeric mode for "HTTPS://" and byte mode for the rest of the path.
Step 2: Error Correction Encoding
QR codes use Reed-Solomon error correction, which adds redundant data so the code can be read even when partially damaged. There are four levels:
- Level L (Low) — Recovers up to 7% of data. Smallest QR code size.
- Level M (Medium) — Recovers up to 15% of data. Good balance for most uses.
- Level Q (Quartile) — Recovers up to 25% of data. Recommended for printed materials.
- Level H (High) — Recovers up to 30% of data. Best for harsh environments or when embedding logos.
Higher error correction means a larger QR code (more modules), but greater resilience. If you plan to place a logo over the center of your QR code, you should use Level H to compensate for the obscured modules.
Step 3: Module Placement and Masking
After encoding, the data bits are placed into the QR matrix following a specific pattern. A mask pattern is then applied to ensure the code has a balanced distribution of black and white modules — this prevents large uniform areas that could confuse scanners.
The encoder evaluates eight possible mask patterns and selects the one that produces the best result according to a penalty scoring system.
Static vs. Dynamic QR Codes
This is one of the most important distinctions to understand when creating QR codes:
Static QR Codes
A static QR code encodes the data directly into the code itself. The data is fixed — once the code is generated, it cannot be changed.
- Pros: Free to create, works forever, no internet dependency for non-URL data, no tracking or third-party services involved.
- Cons: Cannot update the destination after printing, no scan analytics, longer URLs create denser (harder to scan) codes.
- Best for: WiFi credentials, vCards, plain text, email addresses, fixed URLs that won't change.
Dynamic QR Codes
A dynamic QR code encodes a short redirect URL. The actual destination is stored on a server and can be changed at any time without reprinting the code.
- Pros: Editable destination, scan tracking and analytics, shorter encoded URL means smaller code, A/B testing capability.
- Cons: Requires a service provider (often paid), dependent on the redirect server staying online, privacy considerations.
- Best for: Marketing campaigns, print materials where the URL may change, situations requiring scan analytics.
Our QR Code Generator creates static QR codes — your data is encoded directly and processed entirely in your browser. Nothing is sent to any server, making it the most private option available.
How to Create a QR Code: Step-by-Step Tutorial
Let's walk through creating QR codes using DevToolkit's free QR Code Generator.
Step 1: Choose Your Content Type
Decide what data you want to encode. Common options include:
-
URL — A website link (e.g.,
https://devtoolkit.cc) - Plain text — Any text message
- WiFi credentials — Network name, password, and encryption type
- vCard — Contact information (name, phone, email, address)
- Email — Pre-filled email address with optional subject and body
- SMS — Phone number with optional pre-filled message
- Geographic coordinates — Latitude and longitude for map locations
Step 2: Enter Your Data
Navigate to the QR Code Generator and enter your content. For a URL, simply paste the full address including https://. For WiFi sharing, you'll format it as:
WIFI:T:WPA;S:YourNetworkName;P:YourPassword;;
For a vCard contact:
BEGIN:VCARD
VERSION:3.0
N:Doe;John
FN:John Doe
TEL:+1-555-123-4567
EMAIL:john@example.com
END:VCARD
Step 3: Configure Options
Adjust the settings for your use case:
- Size — Larger sizes are easier to scan from a distance. For print, use at least 300x300 pixels.
- Error correction level — Use Level M for most cases, Level H if you plan to overlay a logo.
- Colors — Customize foreground and background colors (keep high contrast for best readability).
Step 4: Generate and Download
Click generate and your QR code appears instantly — everything is processed in your browser. Download the image in PNG format for digital use, or SVG for print materials that need to scale to any size.
Step 5: Test Before Deploying
Always test your QR code before printing or publishing:
- Scan with at least two different devices (iOS and Android).
- Test at the distance and size it will be used at.
- Verify the correct destination or data appears.
- Try scanning at different angles and lighting conditions.
QR Code Use Cases
QR codes have found applications across virtually every industry. Here are the most impactful use cases:
Marketing and Advertising
- Print-to-digital bridge — Link flyers, posters, and business cards to landing pages, portfolios, or social media profiles.
- Product packaging — Direct customers to instruction manuals, ingredient lists, or loyalty programs.
- Billboard and transit ads — Enable instant engagement from physical advertisements.
- Event promotions — Link to registration pages, schedules, or venue maps.
Pro tip: When creating URLs for marketing QR codes, add UTM parameters to track campaign performance. You can use our URL Encoder to properly encode special characters in your tracking URLs.
Payments and Financial Services
- Mobile payments — Systems like Alipay, WeChat Pay, and many banking apps use QR codes for peer-to-peer and merchant payments.
- Invoice payments — Encode payment details so customers can scan and pay instantly.
- Cryptocurrency addresses — Share Bitcoin and Ethereum wallet addresses without error-prone manual entry.
WiFi Sharing
One of the most practical everyday uses. Instead of dictating a complex password, create a QR code that automatically connects the scanner's device to your WiFi network. The format is:
WIFI:T:WPA;S:NetworkName;P:Password;H:false;;
Where T is the encryption type (WPA, WEP, or nopass), S is the SSID, P is the password, and H indicates whether the network is hidden. This is perfect for offices, cafes, Airbnb rentals, and home guests.
Contact Sharing (vCards)
Encode your full contact information — name, phone numbers, email, company, title, address, and website — into a QR code. When scanned, the contact is automatically added to the scanner's address book. This is far more reliable than exchanging paper business cards.
Restaurant and Hospitality
- Digital menus — Became standard during COVID-19 and remain popular for cost savings and easy updates.
- Table ordering — Scan to open an ordering app without downloading anything.
- Hotel check-in — QR codes on confirmation emails for express check-in at kiosks.
- Review requests — Link directly to Google Reviews or Yelp pages.
Education and Events
- Classroom materials — Link textbook pages to supplementary videos, quizzes, or interactive simulations.
- Event tickets — Unique QR codes serve as scannable admission tickets.
- Conference networking — Attendee badges with QR codes linking to LinkedIn profiles or digital business cards.
- Museum exhibits — Provide detailed information, audio guides, or AR experiences.
Software Development
- App store links — Direct users to the correct app store listing for their platform.
- Two-factor authentication (2FA) — TOTP setup codes for apps like Google Authenticator use QR-encoded URIs.
- API documentation — Link to live API endpoints or Postman collections from printed documentation.
- Deployment URLs — Share staging or preview environment URLs with team members quickly.
For developers working with 2FA TOTP URIs, the format typically looks like this:
otpauth://totp/Example:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example
You can encode these URIs directly using our QR Code Generator. If you need to encode or decode the URI components, check out our Base64 Encoder and URL Encoder/Decoder.
QR Code Best Practices
Follow these guidelines to ensure your QR codes work reliably in the real world:
Size and Scaling
- Minimum size — For close-range scanning (within 30 cm), the QR code should be at least 2 cm x 2 cm (about 0.8 inches).
- Distance rule — As a general guideline, the QR code should be roughly 1/10th of the expected scanning distance. For a billboard readable from 10 meters away, the code should be at least 1 meter wide.
- Quiet zone — Always maintain a white border of at least 4 modules around the code. Most generators handle this automatically.
- Resolution — For print, generate at 300 DPI or higher. Use SVG format for scalable vector output that looks sharp at any size.
Color and Contrast
- High contrast is essential — Dark foreground on a light background works best. The ideal combination is black on white.
- Never invert colors — Light modules on a dark background can cause scanning failures. If you use custom colors, keep the foreground darker than the background.
- Avoid gradients — Uniform module colors ensure reliable scanning.
- Test custom colors — If using brand colors, always test with multiple devices. A good rule is to maintain a contrast ratio of at least 4:1 between foreground and background.
- Transparent backgrounds — Avoid them for QR codes. A solid light background ensures consistent scanning across different surfaces.
Content Optimization
- Shorter is better — Shorter URLs produce less dense QR codes that are easier to scan. Use URL shorteners if necessary, but remember that adds a dependency on the shortener service.
- Use HTTPS — Always use HTTPS URLs. Many browsers and apps will warn users about insecure HTTP links.
- Mobile-optimized destinations — Ensure the linked page is mobile-friendly since QR codes are almost always scanned with phones.
- Uppercase URLs — QR codes can encode uppercase alphanumeric characters more efficiently than mixed case. Some generators automatically optimize this.
Error Correction Selection
- Level L (7%) — Use for controlled digital environments where the code won't be damaged (screens, clean apps).
- Level M (15%) — Default choice for most applications. Good balance of size and resilience.
- Level Q (25%) — Recommended for printed materials that may get dirty, folded, or partially covered.
- Level H (30%) — Required when placing a logo or image over the QR code center. The logo should cover no more than 20-25% of the code area.
Testing Checklist
Before deploying any QR code in production, run through this checklist:
- Scan with iOS Camera app (iPhone).
- Scan with Android Camera or Google Lens.
- Scan with at least one third-party scanner app.
- Test at the actual intended viewing distance.
- Test on the actual print material or screen where it will appear.
- Verify the destination loads correctly on mobile.
- Test in low-light and bright-light conditions.
- Confirm the quiet zone is preserved when placed in context.
QR Code Standards and Specifications
QR codes are governed by several international standards:
- ISO/IEC 18004:2015 — The primary QR code standard. Defines symbol structure, data encoding, error correction, and reference decode algorithm.
- AIM ITS 97-001 — The original industry standard from the Automatic Identification Manufacturers association.
- JIS X 0510 — The Japanese Industrial Standard for QR codes.
QR Code Versions
QR codes come in 40 versions (sizes), ranging from Version 1 (21x21 modules) to Version 40 (177x177 modules). Each version adds 4 modules per side. The version is automatically selected based on the amount of data and the error correction level.
Here is the data capacity for common versions at Error Correction Level M:
Version Modules Numeric Alphanumeric Bytes
1 21x21 34 20 14
5 37x37 202 122 84
10 57x57 652 395 271
20 97x97 2061 1249 858
40 177x177 7089 4296 2953
For most use cases, versions 1-10 are sufficient. A typical URL of 50-100 characters will fit in Version 3-5. If your QR code is growing beyond Version 10, consider shortening the encoded data.
QR Code Variants
Beyond the standard QR code, several specialized variants exist:
- Micro QR — Smaller than standard QR, with only one finder pattern. Useful for tiny components and electronics. Holds up to 35 numeric characters.
- iQR Code — Can be rectangular and supports even higher data density. Developed by Denso Wave.
- SQRC — Secure QR Code with built-in data encryption for confidential information.
- Frame QR — Features a customizable canvas area in the center for logos, images, or text.
Comparison of Free QR Code Generators
There are many QR code generators available. Here's how the options compare:
DevToolkit QR Code Generator
- Price: Completely free, no limits
- Privacy: 100% client-side — data never leaves your browser
- Features: Custom colors, adjustable size, error correction selection, PNG and SVG download
- Accounts: No sign-up required
- Ads: Minimal, non-intrusive
- Best for: Developers and privacy-conscious users who want fast, reliable QR code generation
QR Code Monkey
- Price: Free with limitations, paid plans for high-resolution and bulk generation
- Privacy: Server-side processing
- Features: Logo embedding, color gradients, shaped modules, various download formats
- Best for: Users who need heavy design customization
QR Code Generator (qr-code-generator.com)
- Price: Free for static, paid for dynamic QR codes
- Privacy: Server-side processing, account required for some features
- Features: Dynamic QR codes, scan analytics, bulk creation
- Best for: Marketing teams needing scan tracking and dynamic URLs
Google Charts API (Deprecated)
- Price: Free (was)
- Status: Google's QR code API via Google Charts has been deprecated. Projects relying on it should migrate to client-side solutions.
- Best for: Legacy systems only — not recommended for new projects
For developers and anyone who values privacy, the DevToolkit QR Code Generator is the clear choice. No data leaves your browser, there's no sign-up friction, and it produces clean, standards-compliant QR codes instantly.
Generating QR Codes Programmatically
If you need to generate QR codes in your application code, here are the most popular libraries by language:
JavaScript / Node.js
// Using the 'qrcode' npm package
const QRCode = require('qrcode');
// Generate as data URL (for browser display)
QRCode.toDataURL('https://devtoolkit.cc', {
errorCorrectionLevel: 'M',
width: 300,
margin: 2
}, (err, url) => {
// url contains a base64-encoded PNG data URI
console.log(url);
});
// Generate as file
QRCode.toFile('./qrcode.png', 'https://devtoolkit.cc');
Python
# Using the 'qrcode' package (pip install qrcode[pil])
import qrcode
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_M,
box_size=10,
border=4,
)
qr.add_data('https://devtoolkit.cc')
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save("qrcode.png")
Go
// Using the 'go-qrcode' package
package main
import "github.com/skip2/go-qrcode"
func main() {
err := qrcode.WriteFile(
"https://devtoolkit.cc",
qrcode.Medium,
256,
"qrcode.png",
)
if err != nil {
panic(err)
}
}
For quick one-off QR codes or prototyping, using our browser-based QR Code Generator is much faster than writing code. Save programmatic generation for when you need to create QR codes dynamically at scale.
Common Mistakes to Avoid
Even with great tools, QR code implementations can fail. Here are the most common pitfalls:
- Encoding too much data — Stuffing a 500-character URL into a QR code produces a dense, hard-to-scan code. Keep data short. If you need to encode long URLs, use a URL shortener or redirect service.
- Low contrast colors — A yellow QR code on a white background looks stylish but fails spectacularly in practice. Always prioritize readability over aesthetics.
- No quiet zone — Placing the QR code edge-to-edge against other design elements removes the quiet zone, making it unscannable. Always leave white space.
- Printing too small — A QR code that's 1 cm wide on a poster meant to be read from 3 meters away will never work. Follow the 1:10 distance-to-size ratio.
- Not testing — The single biggest mistake. Always test the actual printed or displayed code with real devices before committing to a production run.
- Linking to non-mobile pages — QR codes are scanned by phones. If your landing page isn't mobile-responsive, you're creating a frustrating user experience.
- Using HTTP instead of HTTPS — Modern browsers show security warnings for HTTP URLs. Always use HTTPS.
- Forgetting to track — For marketing campaigns, use UTM parameters or a link shortener with analytics so you can measure QR code performance.
Security Considerations
QR codes are a vector for social engineering attacks. Users should be aware of these risks:
- Malicious URLs — Attackers can create QR codes that link to phishing sites. Always check the URL preview before visiting a scanned link.
- QR code replacement — Fraudsters may place their own QR code stickers over legitimate ones (e.g., on parking meters or payment terminals). Look for signs of tampering.
- Automatic actions — Some QR codes can trigger phone calls, send SMS messages, or add calendar events. Review what the scan will do before confirming.
- WiFi QR codes — A malicious WiFi QR code could connect your device to an attacker-controlled network. Only scan WiFi codes from trusted sources.
As a QR code creator, you can help by using HTTPS URLs, keeping your linked domains trustworthy, and including a visible URL near the QR code so users know where they're going.
Frequently Asked Questions
Are QR codes free to create?
Yes. Static QR codes are completely free to create and use. The QR code specification is open and royalty-free. Tools like the DevToolkit QR Code Generator let you create unlimited QR codes at no cost. Dynamic QR codes with analytics typically require a paid service.
Do QR codes expire?
Static QR codes never expire — the data is encoded directly in the image. However, the content they link to can become unavailable (e.g., a website goes offline). Dynamic QR codes may expire if the redirect service is discontinued or your subscription lapses.
What is the maximum data a QR code can hold?
A Version 40 QR code (the largest standard size at 177x177 modules) with the lowest error correction (Level L) can hold up to 7,089 numeric characters, 4,296 alphanumeric characters, or 2,953 bytes of binary data. In practice, keeping data under 300 characters is recommended for reliable scanning.
Can I put a logo in the center of a QR code?
Yes, but with caveats. Set the error correction level to H (30% recovery) and ensure the logo covers no more than 20-25% of the QR code area. Always test thoroughly afterward — the logo is essentially "damaging" the code, and error correction compensates for it.
What format should I download my QR code in?
Use SVG for print materials — it's a vector format that scales to any size without quality loss. Use PNG for digital use (websites, emails, social media) at a resolution appropriate for the display size. Avoid JPEG for QR codes as compression artifacts can interfere with scanning.
Why won't my QR code scan?
Common reasons include: insufficient contrast between foreground and background colors, the code is too small for the scanning distance, missing quiet zone, the code is printed on a reflective or textured surface, or the error correction level is too low for the amount of damage or obstruction. Try regenerating with higher error correction and testing at the intended size.
Can QR codes be read without an app?
Yes. Since 2017 (iOS 11) and 2018 (Android 9), most smartphone cameras can natively read QR codes without installing any additional app. Simply point your camera at the QR code and a notification or link will appear.
How do I create a QR code for WiFi?
Use the WiFi format string: WIFI:T:WPA;S:YourNetworkName;P:YourPassword;;. Replace WPA with your encryption type, YourNetworkName with your SSID, and YourPassword with the password. Paste this into the QR Code Generator and your guests can connect by scanning.
Start Creating QR Codes Now
QR codes are one of the most practical bridges between the physical and digital worlds. Whether you're sharing a URL, WiFi password, contact information, or building QR-based features into your application, the principles are the same: keep data concise, maintain high contrast, choose appropriate error correction, and always test.
Ready to create your first QR code? Head over to the DevToolkit QR Code Generator — it's free, private (100% client-side), and requires no sign-up. Generate a QR code in seconds and download it as PNG or SVG.
For more developer tools, explore our full collection including the Base64 Encoder/Decoder, URL Encoder/Decoder, and dozens of other utilities — all free, all running in your browser.
Top comments (0)