How to 3D print a QR code that actually scans
A phone does not read a QR code as a picture. It looks for three corner squares, measures the grid between them and decides, square by square, whether each module is dark or light. A printed code fails when that decision becomes ambiguous: modules too small for the nozzle, light gaps that close up, glare, or not enough contrast. Each of these is predictable from a few numbers.
Modules: the number that decides everything
A QR code is a square grid of modules. The grid size is set by the code's version: version 1 has 21 × 21 modules and every version adds 4, so version 2 is 25 × 25, version 3 is 29 × 29 and so on. You do not pick the version directly: the encoder chooses the smallest one that holds your data at the chosen error correction level.
That makes the length of your text the first design decision. The table shows the module count at error correction level M, which the QR Code generator uses, and the resulting module size on two plate sizes with the generator's padding.
| Text length (characters) | Version | Modules | Module on 100 mm plate (92 mm code) | Module on 50 mm plate (44 mm code) |
|---|---|---|---|---|
| up to 14 | 1 | 21 | 4.38 mm | 2.10 mm |
| 15–26 | 2 | 25 | 3.68 mm | 1.76 mm |
| 27–42 | 3 | 29 | 3.17 mm | 1.52 mm |
| 43–62 | 4 | 33 | 2.79 mm | 1.33 mm |
| 63–84 | 5 | 37 | 2.49 mm | 1.19 mm |
| 85–106 | 6 | 41 | 2.24 mm | 1.07 mm |
The lengths are for ordinary text and URLs, which are encoded as bytes. Two consequences follow. A URL with tracking parameters can easily double the module count, so strip everything after the question mark that the page does not need. And if a code will be printed once and used for years, point it at an address you control that redirects to the real page: you can change the destination later without reprinting.
The smallest module your printer can make
Dark modules on a printed plate merge into larger blobs, which is fine because they are the same colour. The critical features are the light ones: a single light module surrounded by dark ones is a pit one module wide, and a light line between two dark areas is a gap one module wide. If those close, the reader sees dark where it expects light.
The same rule that governs small lettering applies. A 0.4 mm nozzle draws lines about 0.4–0.45 mm wide, and a feature needs about two line widths to print as a real shape with two edges, as explained in the small text guide. That gives:
- 0.8 mm per module: the floor on a 0.4 mm nozzle. It prints, but every tenth of a millimetre of over-extrusion eats into the light gaps.
- 1–1.5 mm: reliable for keychains and small tags.
- 2 mm and up: comfortable, tolerant of a less tuned printer and readable from further away.
Working backwards: a code with 29 modules at 1.2 mm per module is 34.8 mm wide before padding. A 0.2 mm nozzle halves the floor, but small codes with tiny modules are also harder for phones to focus on, so it rarely pays to go below 1 mm.
Error correction: L, M, Q or H
QR codes carry redundant data that lets a reader recover from damage. The four levels restore roughly 7 % (L), 15 % (M), 25 % (Q) and 30 % (H) of the code's data. More redundancy means more modules for the same text. For a 40-character URL:
| Level | Recovers about | Modules for 40 characters | Module on a 92 mm code |
|---|---|---|---|
| L | 7 % | 29 | 3.17 mm |
| M | 15 % | 29 | 3.17 mm |
| Q | 25 % | 33 | 2.79 mm |
| H | 30 % | 37 | 2.49 mm |
Here M costs nothing over L, which is often the case, because versions come in fixed steps. Error correction is not a fix for bad printing: it absorbs a scratch or a few wrong modules, but a code where every light gap has narrowed is wrong everywhere at once. Choose a higher level for codes that will be handled, scratched or partly covered, and spend any spare plate area on larger modules otherwise.
A logo placed over the centre of a code destroys the modules under it, and the reader treats them as damage. It works only with a high level, a small logo, and the three corner squares and their surroundings left untouched. Every covered module uses up recovery that would otherwise absorb print defects, so test such codes harder than plain ones.
Plate size and scanning distance
The QR specification asks for a quiet zone of four modules of light colour around the code. Phone readers usually manage with less, especially when the plate sits on a plain surface, but a code mounted directly against a busy or dark background needs the margin. The generator's padding is set in millimetres, so convert it: 4 mm of padding is about one module on a 25-module code at 100 mm. If a code scans badly on its final background, more padding is the first thing to try.
For distance, a common rule of thumb in print design is that a code can be scanned from about ten times its width. It assumes a code with a moderate module count; denser codes need to be larger for the same distance. In numbers:
- A 30 mm keychain code: scanned from about 30 cm, in practice held close to the phone.
- A 92 mm code on a table plate: about 0.9 m.
- A sign meant to be read from 3 m across a room: about 300 mm wide.
The opposite limit exists too. Phones need a minimum distance to focus, so a very small code held very close may stay blurred. If you need a code below about 25 mm, keep the text short so the modules stay large.
Contrast, colour and surface finish
Readers convert the image to black and white with a threshold, so what matters is the brightness difference between the two colours, not the colours themselves. Dark modules on a light base is the standard and the safest choice.
- Good pairs: black or dark blue on white; dark brown on light yellow. Check by converting a photo of the two filaments to greyscale: they should look clearly different.
- Poor pairs: red on black, blue on green, two pastel colours, or grey on white. They look distinct to the eye and similar to a threshold.
- Inverted codes (light modules on dark) are decoded by many current readers but not all. For a permanent print, stay with dark on light.
- Finish: glossy and silk filaments reflect the light source straight into the camera, which turns modules into bright patches. Matte filaments scan more reliably. A thin white base also lets a dark surface behind it show through; the generator's 1.6 mm base avoids that for most white filaments.
Raised, flush or single-colour
Raised modules with one filament change
The generator's layout: a light base, with the dark modules standing on top of it. Every colour boundary is the top face of the base, so one filament change at the first module layer gives a two-colour code on any single-nozzle printer. Find the layer in the preview and add the change as described in the multi-colour guide. Two or three layers of module height (0.4–0.6 mm at 0.2 mm layers) is enough for colour. Taller modules make the change easier to place but cast shadows and show their dark sides when the code is scanned at an angle, so keep them low for codes on walls or doors.
Flush (inlaid) codes
The modules sit level with the base, usually because the plate is printed face down so the code is the first layer against the bed. This needs both colours in the same layer, which means a multi-material system; the 3MF export keeps the two colours as separate parts for that. The result is flat and easy to clean, and on a textured plate the face comes out matte, which is good for scanning. The first layer must be clean, see first layer problems.
Single colour
A code made only of raised and recessed areas in one filament has no contrast of its own; the reader sees shadows. It scans under light from the side and often fails under even room light. If you only have one colour, print the raised version and colour the tops afterwards: roll a small foam roller with acrylic paint lightly across the modules, or use a paint marker. Only the raised faces pick up colour.
Print settings that keep the gaps open
Almost every scanning failure on a code with adequate module size comes from material ending up where a light module should be:
- Flow: over-extrusion widens every dark module and narrows every light gap. If the light pits look smaller than the dark squares, check flow before changing anything else.
- Stringing: dark strings across a light base read as dark modules. Travel between modules is constant on a code, so tune retraction and temperature with the stringing guide before printing one.
- Colour contamination: purge the new colour fully at the change. A grey tint on the first dark layer is harmless; dark specks on the light base are not, because they can be read as modules.
- Elephant foot: matters only for flush codes printed face down, where the first layer is the code. Use elephant foot compensation so the dark first-layer modules do not spread into the light ones.
- Top surface: ironing the top of the base before the change gives a smoother light background and fewer glints from layer lines.
Before printing a batch, scan the finished first copy with two or three different phones, at the distance and angle where it will hang, under the lighting it will have. A code that scans on your desk under a lamp can fail on a dim shelf.
A Wi-Fi code stores the network name and password in plain text, in the form WIFI:T:WPA;S:name;P:password;;. Anyone who scans it, or photographs it, has the password for as long as the print exists. Use a guest network for printed codes.
Codes that are not meant to scan
The Secret QR generator borrows the look of a QR code for something else: two plates that each look like random noise and reveal a hidden image when stacked against light. They are not scannable codes, and their printing rules are different: each plate is a single 0.2 mm layer in a translucent white and an opaque black, printed in one layer with a multi-material system, and the modules should stay above about 1 mm so the plates line up. For codes that carry data without being visible, an NFC tag inside the print is the alternative, and for linear codes see the barcode generator.
Frequently asked questions
How small can a 3D printed QR code be?
It depends on the module count, not the outer size. With a 0.4 mm nozzle, keep each module at 1 mm or more; 0.8 mm is the floor. A short URL that needs 25 modules can therefore be printed at about 25–30 mm, while a long one that needs 41 modules needs about 45–50 mm for the same module size.
Why does my printed QR code not scan when the preview does?
The preview is perfect geometry. On the print, the usual causes are light gaps that closed up through over-extrusion or elephant foot, dark strings across light modules, a light base contaminated by the second colour, glare from a glossy or silk filament, or modules smaller than about 1 mm.
Which error correction level should I use for a printed code?
Level M is a good default for printed codes. Use L only when the data barely fits and you need bigger modules. Use Q or H for codes that will be scratched, dirty or partly covered, and accept that the code gets denser and needs a bigger plate.
Can I print a QR code in one colour?
You can, but it relies on shadows between raised and recessed areas, so it scans only under light that comes from the side. For a code other people will scan in normal room light, use two colours, or paint or ink the tops of the raised modules.
Do inverted QR codes (light modules on dark) work?
Many current phone readers decode them, but not all. A printed code is permanent, so use the standard dark modules on a light background unless you have tested the inverted version on several phones.