QR Meadow
English

QR code size in pixels: exports, screens and the scaling trap

A 1024 × 1024 PNG from QR Meadow gives a short link 31 pixels per module and a full contact card 14. For print, the pixels you need are millimetres ÷ 25.4 × dpi. On screens, how the image is scaled matters more than its size.

Count pixels per module

A QR code of version v has 17 + 4v modules per side (DENSO WAVE) plus a four-module quiet zone on each side. QR Meadow’s PNG export gives every module a whole number of pixels, the largest that fits the chosen size, and adds any leftover pixels to the margin:

Export options: PNG size 1024 × 1024 px, PDF width 5 cm (2 in), Download PNG, Copy image, Download SVG, Download PDF
PNG at 512, 1024 or 2048 pixels; SVG and PDF are vector and have no pixel size.
ContentModules (+ quiet zone)512 px PNG1024 px2048 px
Short link, version 225 (33)15 px per module3162
Wi-Fi network, version 329 (37)132755
Contact card, version 1161 (69)71429

Pixels per module = ⌊PNG width ÷ (modules + 8)⌋. A short link at 512 px: ⌊512 ÷ 33⌋ = 15; the remaining 512 − 15 × 33 = 17 pixels become extra margin.

Pixels for print

Printed width in pixels is millimetres ÷ 25.4 × dpi. At 300 dpi:

Printed code widthPixels at 300 dpiPixels at 600 dpiSmallest PNG that covers 300 dpi
2 cm236472512 px
3 cm354709512 px
5 cm5911,1811024 px
10 cm1,1812,3622048 px

For print it is simpler to skip pixels: the SVG and PDF downloads are vector, and the PDF can be saved 2, 3, 5 or 10 cm wide.

The scaling trap

When an image is shown or printed at a size that is not a whole multiple of its module grid, module edges fall between pixels and turn grey. In the decoder test, that mattered more than resolution for large codes:

The corner of a version 40 QR code at exactly 3 pixels per module next to the same code resampled to 3.5 pixels per module with grey edges
Pixel-aligned at 3 px per module the version 40 code decoded; resampled at 3.5 px per module, 4 of 10 offsets did.

Every pixel-aligned image decoded, at 1, 2 or 3 pixels per module, version 40 included. Resampled, a version 40 code decoded at 4 of 10 offsets at 3.5 pixels per module and 0 of 10 at 6.5; the maximum size guide has the full table. Short codes were far less sensitive: a short link decoded at every offset from 1.75 pixels per module in sharp images.

Test: version 40 at level L, averaged down to each resolution at 10 random sub-pixel offsets, against images where every module is exactly 1, 2 or 3 pixels. Decoder jsQR 1.4.0 on synthetic images, not phone photos; how the tests work.

Phone camera apps are more forgiving: in our phone test both an iPhone and an Android phone read a 50 mm version 40 code from a screen. The trap matters most where the reader is a simpler decoder, such as a web page or app that scans images with an open-source library, and for codes near the top of the version range.

What a separate camera-model test adds

Export pixels are not the pixels that reach a decoder after camera capture. In the declared 1920 × 1080, 60° model, a front-facing 10 mm version 11 symbol projects to approximately 1.82, 1.36 and 0.91 pixels per module at model distances of 15, 20 and 30 cm. The starting PDF was rasterised at 300 dpi; it did not guarantee that each captured module would have enough pixels.

Those distances depend on the assumed field of view and resolution. They are not calibrated to a phone, and the model omits camera processing. Use the result to understand why a large export can still be hard to capture, not to promise a particular scanning range.

Separate synthetic-image study, QM-LAB-20261028, not a phone or physical-print test. Distances are projections under assumed camera settings, not measured scan ranges. Method, limits and downloadable results.

Codes on screens and in emails

Web pages size images in CSS pixels, and high-density displays draw each CSS pixel with several physical pixels; the ratio is the device pixel ratio, which depends on the device (MDN). Unless the displayed size times that ratio matches the image’s own grid, the browser resamples the code. What helps:

  • Use SVG where you can. A vector code is drawn at whatever size the page needs, with sharp edges.
  • Shrink rather than enlarge. Export a PNG at least as large as it will appear on the largest screen, and keep codes on screens short: a version 2 or 3 code tolerated resampling far better than version 40 in the test.
  • If a small PNG must be enlarged, CSS image-rendering: pixelated scales it by nearest neighbour to a whole multiple first, keeping edges hard (MDN).

Questions

What size PNG should I download for printing?

512 px covers a 3 cm code at 300 dpi, 1024 px a 5 cm code and 2048 px a 10 cm code. For any size, the SVG or PDF is sharper.

How do I convert QR code pixels to centimetres?

Centimetres = pixels ÷ dpi × 2.54. A 1024 px PNG printed at 300 dpi is 1024 ÷ 300 × 2.54 ≈ 8.7 cm wide, quiet zone included.

Sources

  1. DENSO WAVE, “Information capacity and versions of QR Code”
  2. MDN, Window: devicePixelRatio property
  3. MDN, image-rendering
  4. jsQR, the decoder used in the tests (GitHub)

Tools used in this guide

More guides