Skip to main content

Przewodnik techniczny · ISO/IEC 18004

Jak generowane są kody QR? Pełny proces kodowania wyjaśniony

QR code generation is the forward application of ISO/IEC 18004 encoding: it turns a URL, text, or payload into a square module matrix before anyone scans it. This 2026 guide follows the symbol-generation pipeline only, from data mode selection through final export.

How are QR codes generated?

QR codes are generated by encoding input data into a bit stream, adding Reed-Solomon error correction codewords, mapping bits onto a square matrix of modules, applying an optimal mask pattern, and inserting format and version information plus a mandatory quiet zone. A compliant QR generator automates this ISO/IEC 18004 pipeline to produce a scannable black-and-white symbol.

What does generating a QR code mean?

Generating a QR code means producing the symbol that stores a payload; it is distinct from scanning, which decodes that symbol, and from dynamic redirect management, which happens after the symbol exists.

A QR code is a two-dimensional barcode symbology. Its black and white squares are modules, and their arrangement carries both payload data and the instructions a scanner needs to interpret it.

A QR generator analyzes input and applies the ISO/IEC 18004 rules for capacity, structure, and error correction. A scanner performs the reverse operation; for that decoding flow, see how QR codes work.

A static QR code stores its final payload in the symbol. A dynamic QR code stores a redirect URL in the same kind of symbol, while its editable destination and later analytics live outside the encoding process.

What is the QR code generation pipeline?

The QR code generation process has ten deterministic stages: input analysis, encoding, error correction, message structuring, matrix construction, bit placement, mask selection, format/version insertion, quiet-zone addition, and export.

The following pipeline is suitable for evaluating a QR library or understanding what a generator does when it processes a URL.

  1. 1

    Analyze input and choose a data mode

    The generator selects numeric, alphanumeric, byte, or Kanji encoding from the characters in the payload.

  2. 2

    Encode data into codewords

    Mode and character-count indicators, payload bits, a terminator, and padding are formed into eight-bit codewords.

  3. 3

    Generate error correction

    Reed-Solomon arithmetic creates redundant codewords for the selected recovery level.

  4. 4

    Structure the final message

    Data and error-correction blocks are interleaved in the order required by the selected version and level.

  5. 5

    Construct the matrix

    The generator chooses a QR version and reserves finder, timing, alignment, and information areas.

  6. 6

    Place data bits

    Codeword bits travel through remaining modules in a vertical zigzag pattern, with remainder bits where required.

  7. 7

    Evaluate mask patterns

    All eight XOR masks are scored to avoid patterns that are difficult for cameras to distinguish.

  8. 8

    Insert format and version information

    The chosen error-correction level and mask are BCH-protected; versions 7 and above also receive version information.

  9. 9

    Add the quiet zone

    A clear border at least four modules wide separates the symbol from neighboring artwork.

  10. 10

    Export and validate

    The finished matrix can be rendered as PNG, SVG, PDF, or EPS and tested at its intended print size.

Create a free QR code after reviewing the pipeline

Step 1: How does a generator choose a QR code data mode?

Choose the data mode by character set, not by payload type name. Numeric data packs most tightly, while URLs and WiFi strings usually require byte mode because they contain lowercase letters and punctuation.

A data mode is the rule set used to convert characters into bits. A URL such as https://example.com commonly uses byte mode; a WiFi payload string also commonly uses byte mode, but has a different payload structure. See types of QR codes for format-selection guidance.

ModeCharacter setBest for
Numeric0–9Phone numbers, numeric IDs, and digits-only payloads
Alphanumeric0–9, A–Z, space, $ % * + - . / :Uppercase coupon codes and simple identifiers
ByteISO 8859-1 or arbitrary byte sequencesURLs, email, WiFi strings, mixed-case and UTF-8 text
KanjiShift JIS double-byte charactersEligible Japanese text
Explore types of QR codes

Step 2: How is data encoded into codewords?

Encoding converts the selected mode, character count, and payload into bits, then adds a terminator and pad bytes until the selected version's data capacity is filled.

A codeword is an eight-bit unit of either encoded payload data or error-correction information. The mode indicator tells the decoder how to read the following bits, and the character-count indicator tells it how much data follows.

Payload length and error-correction level determine the smallest QR version with enough capacity. A longer URL or a higher recovery level can therefore increase the module count even when the visible design is unchanged.

Step 4: How is the QR matrix built?

A QR matrix is the square grid of modules that holds fixed patterns, data modules, and error-correction modules. Version 1 contains 21×21 modules, and each higher version adds four modules per side.

Finder patterns are the three 7×7 corner markers that help a scanner locate and orient the code. Timing patterns synchronize the module grid, while alignment patterns improve geometric correction on larger versions.

The generator reserves areas for format information and, from Version 7 onward, version information before placing data. Version 40 reaches 177×177 modules.

Step 5: How are codewords placed in modules?

After fixed patterns are reserved, the generator places data and error-correction bits in paired columns that zigzag from the lower-right toward the upper-left of the matrix.

Each bit becomes one light or dark module after masking. Reserved function modules are skipped, and remainder bits fill any capacity that is not represented by a full codeword.

This placement rule is why a QR symbol is a structured matrix rather than a visual hash: every position has a prescribed role.

Step 6: What are QR code mask patterns?

Mask patterns are eight XOR templates applied to data modules to break up large uniform regions and repeated patterns that can make camera detection less reliable.

The generator evaluates all eight masks and assigns penalty points for undesirable runs, blocks, and balance. It uses the lowest-penalty result and records the selected mask in format information.

Masking changes the visual distribution of modules, not the underlying payload. The scanner reads the mask identifier and reverses the operation during decoding.

Step 7: What are format and version information?

Format information tells a scanner the error-correction level and selected mask; version information identifies versions 7 through 40. Both use BCH protection for reliable reading.

Format information is duplicated near the finder patterns because it is needed early in decoding. Version information is placed in reserved areas on larger symbols.

These fields are part of symbol generation, so a code that merely resembles a QR image is not necessarily a valid QR symbol.

Step 8: Why does the quiet zone matter in final output?

The quiet zone is a mandatory clear border of at least four modules on every side. It lets scanners distinguish finder patterns from surrounding text, artwork, and borders.

PNG is useful for fixed pixel output, while SVG, PDF, and EPS preserve vector edges for large-format printing. Raster scaling can blur individual modules, so print resolution must preserve a readable module size.

Use the QR code size guide for physical sizing rules; generation creates the symbol, while production choices determine how faithfully it is reproduced.

Static vs dynamic QR codes in the generation context

Both static and dynamic QR codes start with a generated symbol. A static symbol encodes its final payload, while a dynamic symbol encodes a redirect URL whose destination can be edited later.

The entity chain is encoding → symbol → optional redirect layer → editable URL → scan analytics. Analytics attach when a dynamic redirect is requested, not while the QR matrix is generated.

Read about static vs dynamic QR codes for the business decision, and see plans for dynamic features without assuming every generator exposes low-level version or mask controls.

What happens in a typical QR generator, including QR-Build?

A typical generator automates ISO/IEC 18004 encoding, then renders the finished symbol in the requested format. Design overlays such as color and logo treatments are applied after core symbol generation and must preserve contrast and capacity.

At QR-Build, we treat output validation as a production step: we review core symbol output and use cross-device scan tests on iPhone and Android before export. Compliant generators follow ISO/IEC 18004; implementation details and available controls vary, so verify them in vendor documentation.

Open-source libraries such as ZXing and qrcode.js implement the same core pipeline. Teams needing API-level evaluation can review our QR code generator for developers.

QR code generation vs QR code scanning

Generation encodes forward from data to modules; scanning decodes backward from modules to data. This page covers the forward pipeline only.

Understanding generation helps explain why quiet zones, module size, contrast, and error correction affect reliability. For the camera-detection and decoding sequence, read how QR codes work.

Step 3: What is Reed-Solomon error correction?

Reed-Solomon is the block error-correction code used in QR symbology. It adds redundant codewords before matrix placement so a scanner can reconstruct data when some modules are damaged or obscured.

The percentages below are approximate recovery capacities commonly associated with each level; real results depend on where and how damage occurs. Higher correction reduces available data capacity for a given version and can require a larger symbol.

LevelApproximate recoveryTypical use
L~7%Clean digital displays with low damage risk
M~15%Common general-purpose default; confirm a generator's setting
Q~25%Outdoor placement or moderate wear
H~30%Logo overlays, heavy print, or harsher environments
Read the QR code error correction guide

Data mode and error-correction decision framework

Choose data mode from the permitted characters and choose error correction from physical risk and design treatment. A higher level is not automatically better if it forces modules too small for the final print size.
SituationData modeEC levelOutput tip
Phone number onlyNumericMUse SVG for print
Uppercase coupon codeAlphanumericMTest contrast
URL or WiFi stringByteM; H with a logoPreserve quiet zone
Logo overlayUsually byteHIncrease final print size
Outdoor signUsually byteQ or HCheck the size guide
Campaign with URL changesByte + dynamic redirectMUse a redirect layer and scan analytics

Common mistakes in QR code generation

Most scan failures come from production choices around a correctly generated symbol: cropped quiet zones, insufficient contrast, undersized modules, or a recovery level that does not match the design.

Cropping the quiet zone

Do not place a border, text, or artwork inside the required clear margin.

Using too little error correction for a logo

A logo obscures modules; compensate deliberately and test the final artwork.

Forcing the wrong character encoding

Mixed-case text and non-ASCII content often need byte-aware handling rather than an alphanumeric assumption.

Reducing contrast

Decorative colors can make module boundaries difficult for cameras to separate.

Shrinking a raster file too far

Blurred or merged pixels can destroy module geometry even when the source matrix was valid.

Trusting a QR-like image

A square pattern must include valid structure, information fields, and quiet zone to be spec-compliant.

Best practices for reliable QR generation

Use a spec-compliant generator, preserve a four-module quiet zone, match error correction to physical conditions, and test the final exported asset on more than one device before mass production.

Start with ISO/IEC 18004 output

Use a generator or library that documents standards-based QR encoding.

Match recovery to the environment

Factor in print wear, logo coverage, lighting, and expected viewing distance.

Keep the quiet zone intact

Treat the white border as part of the symbol, not as optional surrounding whitespace.

Test iOS and Android

Test the final printed or displayed asset, not only the source file on one screen.

Choose vector for large print

SVG, PDF, or EPS help preserve crisp module edges at larger dimensions.

Use dynamic QR codes for changing campaigns

An editable redirect destination avoids re-encoding when a campaign URL changes; scan analytics occur on that redirect layer.

Glossary: QR code generation terms

These definitions describe the connected parts of one process: data mode creates codewords, codewords become modules, and modules form a QR symbol governed by ISO/IEC 18004.

Module

One black or white square cell in a QR matrix.

Codeword

An eight-bit unit of encoded data or error-correction information.

Data mode

The character-encoding scheme selected before payload bits are created.

Error correction level

The L, M, Q, or H setting that controls redundant Reed-Solomon codewords.

Mask pattern

One of eight XOR templates used to improve module distribution.

Quiet zone

The required clear border of at least four modules around a QR symbol.

Finder pattern

One of the three large corner patterns that supports detection and orientation.

Alignment pattern

A smaller reference pattern that helps correct distortion in larger versions.

Timing pattern

Alternating modules that help synchronize the scanner to the grid.

Version

The QR size tier; Version 1 is 21×21 modules and each step adds four modules per side.

Format information

BCH-protected data identifying the error-correction level and selected mask.

Reed-Solomon

The error-correction algorithm that adds recoverable redundancy to QR codewords.

Static QR code

A symbol whose encoded payload remains fixed after creation.

Dynamic QR code

A symbol that encodes a redirect URL while its destination remains editable behind that redirect.

Related QR code resources

Frequently asked questions

These answers address QR code symbol generation, not the separate scanning tutorial or QR format taxonomy.

How are QR codes generated?

QR codes are generated by encoding input into bits, adding Reed-Solomon error correction codewords, placing data in a module matrix, applying a mask, inserting format and version information, and adding a quiet zone under ISO/IEC 18004.

What algorithm is used to generate QR codes?

QR generation follows ISO/IEC 18004. Its core algorithm includes data-mode selection, bit encoding, Reed-Solomon error correction, zigzag matrix placement, mask scoring, and format-information insertion.

How does a QR code generator turn a URL into a QR code?

A generator typically encodes an https URL in byte mode, selects a version from data length and error-correction level, constructs the module matrix, selects a mask, and exports the finished symbol.

What are QR code data modes?

Numeric, alphanumeric, byte, and Kanji modes define how characters convert to bits. Numeric is compact for digits, while byte mode handles URLs, mixed-case text, and arbitrary byte data.

When should I use byte mode versus alphanumeric mode?

Use byte mode for URLs, lowercase text, and special characters. Use alphanumeric mode only when the payload stays within its uppercase letters, digits, space, and limited-symbol set.

What is Reed-Solomon error correction in QR codes?

Reed-Solomon adds redundant codewords so a scanner can recover data when modules are damaged. Increasing from L through H generally increases recovery capacity while reducing data capacity for a version.

What are QR code mask patterns?

Eight mask patterns XOR with data modules to prevent large uniform regions and repeated structures. The generator scores each result and selects the lowest-penalty mask.

How many modules are in a QR code?

Module count depends on version. Version 1 is 21×21 modules, each version adds four modules per side, and Version 40 is 177×177 modules.

How is QR code version determined?

A generator selects the smallest version that fits the payload under the chosen data mode and error-correction level. More data or higher recovery requires more capacity.

Does generating a QR code require an internet connection?

No. Generation is local computation. Internet is only needed to use a cloud service or to access content at a URL encoded in the finished symbol.

What is the difference between generating and printing a QR code?

Generation creates a digital symbol; printing reproduces it on a physical surface. Final scan reliability depends on contrast, module size, quiet-zone preservation, and print quality.

Can I change a QR code after it is generated?

A static QR code has fixed encoded data. A dynamic QR code can keep its symbol while changing the destination behind its redirect URL; visual changes still require a safe re-export.

What is a quiet zone and why does it matter?

The quiet zone is a clear border of at least four modules around a QR symbol. Cropping it can prevent scanners from finding the symbol reliably.

What happens when you click Generate in QR-Build?

QR-Build processes the supplied content through the QR encoding pipeline, applies optional design treatments, and exports a scannable symbol. Dynamic QR workflows also register a redirect URL for later editing and analytics.

Ready to turn data into a QR code?

Use QR-Build to create a standards-based QR symbol, then validate it in the environment where people will scan it.

Create a QR code with QR-Build
QR Code - QR-Build

Create your QR code

Create QR code