QR Code Generator Guide: How QR Codes Work, What You Can Encode, and How to Get the Best Scan Results
From the math behind the matrix to practical scannability tips — everything you need to create QR codes that actually work.
What is a QR code?
QR stands for Quick Response. A QR code is a two-dimensional matrix barcode invented by Denso Wave in 1994 to track automotive parts on fast-moving assembly lines. Unlike a traditional one-dimensional barcode — which stores data only horizontally — a QR code stores data in both directions, packing far more information into a compact square. Today QR codes are everywhere: restaurant menus, product packaging, payment terminals, event tickets, conference badges, and real estate signs.
You can create one instantly with the free QR Code Generator on sourcecodestack — no account, no watermark, and nothing uploaded.
How a QR code stores data
A QR code is a square grid of dark and light cells called modules. Each module is either 1 (dark) or 0 (light), and the complete arrangement encodes a string of binary data. The standard used is ISO/IEC 18004.
Finder patterns and alignment markers
Three large square patterns sit in the top-left, top-right, and bottom-left corners of every QR code. These are the finder patterns. A scanner locates them first to detect the code's position, orientation, and size — even if the image is rotated, skewed, or photographed at an angle. Larger QR codes (version 7 and above) also include smaller alignment patterns distributed across the grid to help correct for lens distortion and curved surfaces.
Timing patterns and format information
Alternating dark and light modules run in two rows between the finder patterns. These timing patterns tell the reader the module grid size. Format information is stored in fixed regions adjacent to the finder patterns and encodes two things: the error correction level in use and the masking pattern applied to the data region.
Data encoding and masking
The actual payload is encoded in one of four modes — numeric, alphanumeric, byte, or Kanji — and then XOR-masked with one of eight standard mask patterns. Masking ensures the data region does not accidentally look like a finder pattern and that no large area of the grid is uniformly dark or light, which would confuse decoders. The QR standard evaluates all eight masks and picks the one that produces the most balanced distribution of dark and light modules.
The quiet zone
Around the entire code is a border of light space called the quiet zone. The standard requires at least four modules on every side. This blank margin gives scanners a clean visual boundary to detect where the code starts and stops. Printing a QR code flush against colored text, images, or the edge of a label is one of the most common reasons codes fail to scan — the quiet zone gets crowded out.
Error correction explained
QR codes use Reed-Solomon error correction, the same algorithm used in CDs, DVDs, and data storage. The encoder adds redundant data so that even a damaged or partially obscured code can be reconstructed. There are four levels:
- L — Low (7%): Up to 7% of codewords can be restored. Produces the simplest, least dense pattern. Ideal for clean digital displays where no physical damage is possible.
- M — Medium (15%): The default for most uses. Good balance between density and resilience. Works well on printed materials that will not be heavily worn.
- Q — Quartile (25%): Useful when you want to overlay a small logo in the center of the code without affecting scan reliability.
- H — High (30%): Up to 30% of the code can be damaged or covered. Choose this for outdoor signs, product packaging that may get scuffed, or any code with a branded logo overlay.
Higher error correction always produces a denser, more complex pattern because more redundant data must be stored. The QR Code Generator on sourcecodestack lets you select L, M, Q, or H so you can match the level to your printing context.
QR code versions and capacity
A QR code's version is a number from 1 to 40 that describes the size of the module grid. Version 1 is a 21×21 grid; version 40 is a 177×177 grid. Each step up in version adds four modules to each side. Higher versions store more data but produce physically larger and denser codes. Most QR code libraries, including the one used by this site, automatically choose the minimum version needed to encode your content at the chosen error correction level — so shorter URLs produce simpler, easier-to-scan codes.
Data types you can encode
The QR standard itself stores raw text or bytes. What makes that text meaningful to a scanning app is a set of widely adopted URI schemes and data formats. Here is a summary of everything supported by the generator on this site:
| Type | Format stored in the QR code | What the scanner app does | Best use |
|---|---|---|---|
| URL | https://example.com/path | Opens the URL in the default browser | Menus, landing pages, social profiles |
| Plain text | Any plain string | Displays the text or copies to clipboard | Coupon codes, serial numbers, notes |
| mailto:name@example.com | Opens mail app with address pre-filled | Business cards, contact forms | |
| Phone | tel:+15551234567 | Prompts to call the number | Flyers, storefront signs |
| SMS | sms:+15551234567 | Opens messages app with number ready | Customer service opt-ins, alerts |
| Wi-Fi | WIFI:T:WPA;S:MyNet;P:pass;; | Joins the network automatically | Cafes, hotels, Airbnbs, offices |
| vCard | BEGIN:VCARD … END:VCARD | Offers to save the contact | Business cards, name badges |
| Geo | geo:37.7749,-122.4194 | Opens the location in the maps app | Event venues, delivery instructions |
URL QR codes
The URL type is by far the most common. Any string beginning withhttp:// or https:// is recognized by every modern smartphone camera without a dedicated QR app. One important practical tip: shorter URLs produce less complex codes. If your destination URL is long, consider using a URL shortener before encoding — the resulting QR code will be simpler and scan faster, especially in low light.
Wi-Fi QR codes
The Wi-Fi data format (WIFI:T:WPA;S:ssid;P:password;;) is supported natively on iOS 11+ and Android 10+. Scanning the code presents the user with a "Join Network" prompt — no typing required. Because the code embeds the real network password, generating it client-side (as sourcecodestack does) means the password is never sent to any server. The tool supports WPA/WPA2, WEP, and open (no-password) networks.
vCard QR codes
A vCard-encoded QR code stores structured contact information: name, organization, title, phone, email, address, and website. When a smartphone scans it, the phone OS offers to add the contact directly to the address book. For a business card, a vCard QR code printed on the back means your contact details survive even when the physical card is lost — anyone who scanned it already has the data saved.
Geo QR codes
The geo: URI scheme encodes a latitude and longitude. Scanning it opens Google Maps, Apple Maps, or the platform default with a pin at that location. This is ideal for event invitations, real estate listings, delivery location markers, and any printed material where giving someone "the address" is less precise than giving them exact coordinates.
Static vs. dynamic QR codes
This distinction matters far more than most people realize.
A static QR code encodes the destination data directly inside the image. The image is the entire system — no server, no subscription, no account. The code works forever as long as the underlying destination (such as a URL) remains live. Static codes cannot be edited after printing, but they never expire and never stop working due to a service going offline.
A dynamic QR code (offered by paid platforms like Bitly, QR Tiger, and Beaconstac) encodes a short redirect URL. The scanning device hits that redirect server, which forwards the user to the real destination. The owner can update the destination without reprinting the code. The trade-off is real: if you stop paying, the service shuts down, or the company is acquired, all your printed codes stop working instantly.
The QR Code Generator on sourcecodestack generates static QR codes. They cost nothing, depend on no external service, and last as long as you need them. For permanent uses — business cards, packaging, plaques, signage — static codes are almost always the right choice.
Design and scannability best practices
A QR code that looks beautiful but fails to scan is useless. Here is what actually matters.
Contrast is non-negotiable
The scanner distinguishes dark modules from light ones. Without sufficient contrast, the reader cannot reliably detect the module boundaries. The standard requires a minimum luminance contrast ratio between the dark and light modules. Black on white gives maximum contrast. Inverting to white on black works on most modern apps, but some older dedicated scanners still expect the traditional dark-on-light orientation.
Avoid pastel or low-saturation color pairs. A dark navy on cream usually scans fine. A light gray on white almost never does. When using custom colors for brand alignment, always test with at least two different scanning apps before printing.
Minimum print size
The practical minimum for reliable scanning is about 2 cm × 2 cm (roughly 0.8 inches square) at an expected scanning distance of 20 cm (about 8 inches). For larger venues — a poster, a sign, a projected slide — scale proportionally. A code on a billboard needs to be scanned from meters away, so it must be correspondingly large. The rule of thumb is that the print size should be at least 10 times the expected scanning distance divided by 100. When in doubt, go bigger.
The generator on this site produces PNGs up to 1024 px. For standard business card or flyer use, 512 px or 1024 px is more than enough. For large-format printing, download at 1024 px and instruct your print shop to scale up without interpolation.
Protect the quiet zone
Leave white space around the entire code. The required four-module quiet zone is a hard minimum; in practice, keeping six to eight modules of margin on all sides prevents edge-case failures when a scan app is aggressive about cropping. In layouts where space is tight, use a white background box behind the code rather than overlapping the quiet zone with other content.
Choose error correction to match the environment
If the code will live in a controlled, clean digital context (a website, an email, a presentation slide), Level L or M is fine and produces a cleaner, less dense pattern. If the code goes on a product that might get wet, scratched, or exposed to UV (outdoor signage, packaging, equipment tags), choose Level H. If you want to add a logo overlay, use Level H and keep the logo under 25% of the total code area.
Always test before printing
This step is the most skipped and the most important. Test the final exported image with at least two different smartphone cameras (iOS and Android if possible) and in the lighting conditions where the code will actually be used. A code that scans perfectly on a bright monitor may struggle on a matte-laminated print under warm restaurant lighting. If any test fails, raise the error correction level, increase the size, or improve the contrast.
Real-world use cases
Restaurant and cafe menus
Contactless QR menus became ubiquitous during the pandemic and have largely stayed because they are cheaper to update than printed menus and eliminate the hygiene concern of passing laminated cards between tables. A URL QR code pointing to your online menu on a table tent or stand does the job. If the menu URL changes seasonally, you can generate a new code and reprint table cards at near-zero cost.
Business cards
The back of a business card is prime real estate for two QR codes: one URL QR code linking to your professional profile or portfolio, and one vCard QR code so the recipient can save your contact details with a single scan. Together they make the card functional even if the physical card is lost — a photo of the back contains everything.
Events and conferences
QR codes serve multiple roles at events. Tickets carry a unique URL or identifier that the check-in system validates. Exhibitor badges carry vCard codes so attendees can collect contacts without exchanging cards. Session rooms display URL codes linking to the slide deck or speaker bio. Sponsors put Wi-Fi QR codes on banners so attendees can join the venue network without finding a staff member.
Product packaging and retail
A URL QR code on a product label can link to setup instructions, warranty registration, a product demo video, or a review form. Because printing space is limited and packaging is handled, the code needs High error correction and enough size to scan reliably. Some brands use geo QR codes on local-market packaging to link directly to the nearest store locator result.
Payments
Payment QR codes are URL codes pointing to a payment page (PayPal, Stripe, Venmo, UPI, etc.). For a small business, printing a payment QR code at the counter eliminates the need for a card terminal for digital wallet users. The code itself contains only the URL — the actual payment is processed by the payment provider's secure system, so a static URL code is all that is needed.
Education and documentation
Textbooks and printed handouts can link to supplementary videos, interactive exercises, or errata pages with a URL QR code in the margin. Equipment manuals frequently include a QR code on the cover linking to the latest PDF — so the printed manual never becomes outdated. Museum and gallery exhibit labels often use QR codes to provide extended context, audio guides, or accessibility resources.
Why generating QR codes client-side matters for privacy
Many free QR code generators send your input to a remote server before returning the image. That means your URL, Wi-Fi password, phone number, contact details, or private text travels over the internet to a third party. Most services log this data, use it for analytics, or store it indefinitely.
The QR Code Generator on sourcecodestack works entirely inside your browser. The qrcode npm library runs as JavaScript on your device and renders the PNG in memory. Not a single byte of your input is transmitted anywhere. This is particularly important for Wi-Fi codes (which embed your real network password), vCard codes (which contain personal contact data), and any URL that you would prefer not to log with a third-party service.
Client-side generation also means the tool works offline. Once the page has loaded, you can disconnect from the internet and continue generating codes — useful for kiosks, field work, or situations where connectivity is unreliable.
How to use the QR Code Generator on sourcecodestack
Open the QR Code Generator and follow these steps:
- Select a content type — URL, Text, Email, Phone, SMS, or Wi-Fi — using the pill buttons at the top of the controls panel.
- Enter your content. For Wi-Fi, fill in the network name (SSID), password, and encryption type. For all other types, type or paste into the text area.
- Adjust size using the slider (128 px to 1024 px). For print use, 512 px or larger is recommended.
- Set the margin (quiet zone thickness, 0–8 modules). Keep it at 2 or above for anything that will be printed.
- Pick colors for foreground (dark modules) and background (light modules). Keep contrast high.
- Choose error correction level — L, M, Q, or H. Use M for most cases; use H if the code will be printed on a surface prone to wear or if you plan a logo overlay.
- Download the PNG by clicking the button in the preview panel. Test the downloaded file by scanning it with your phone before printing.
Common mistakes and how to avoid them
- Printing too small. A code smaller than 2 cm will fail in any marginally poor lighting. When in doubt, make it bigger.
- Low contrast colors. A light gray foreground on a white background looks subtle and modern but will not scan reliably. Test before committing to a print run.
- No quiet zone. Placing the code flush against a border, image, or text without adequate white space is the single most common reason a freshly printed code fails.
- Encoding a very long URL directly. Longer content means a higher version code with more modules, which is harder to scan at small sizes. Shorten the URL first.
- Using Low error correction on printed materials. Prints smudge, paper folds, and labels get scratched. Medium is the minimum for anything physical.
- Never testing. Always scan the final exported file with a real device before distributing or printing it.
QR code is a registered trademark of Denso Wave Incorporated. The ISO/IEC 18004 standard governs the technical specification. All codes generated on this site are static and contain no tracking.