Software & SaaSEngineering note

Will a QR Code Still Scan After It's Shrunk and Compressed? We Tested It

Every QR code is a grid of squares, and a scanner needs a few pixels per square plus a clear white border. Keep those, and even harsh JPEG compression does not stop it scanning. Lose them, and nothing else helps.

Author

CrpyByte Engineering

Published

Reading time

4 min read

In July 2026 we built a QR code manager for a tax-filing website run by an associated company. Staff create a code for any page, download it, and use it on flyers and social posts. Each code points to the site's own short link, such as /q/AB12CD34, which redirects to the real page. That way a printed code keeps working when the page moves, and every scan is counted.

A week later a code would not scan. The team had placed it into a social post image with an AI image tool, which shrank it to a small corner of the picture. The code downloaded from the manager at that time was only about 250 to 490 pixels wide, and the manager also offered a logo in the middle.

How a scanner reads a QR code

A QR code is a grid of black and white squares, called modules. Our codes encode a short web address with medium error correction, which gives a grid of 29 × 29 modules. The standard also asks for a white border, the quiet zone, four modules wide on every side, so the whole image is 37 modules across.

A scanner has to tell each module apart. That depends on how many pixels each module gets, not on the file size. A 150-pixel image of a 37-module code gives each module about 4 pixels.

What we tested

On 5 August we took the real codes downloaded from the manager and tried to read each version with OpenCV's QR detector, a standard open-source library. We first checked the files directly, then repeated what the image tool does: start from a large download, shrink it, and save it again with compression.

Scan test, 29 × 29 code with a 4-module white border, 5 August 2026
VersionPixels per moduleResult
150 px PNGabout 4Scans
150 px JPEG, quality 60about 4Scans
About 120 pxabout 3.2Scans (the smallest size we checked)
512 px download shrunk to 150, 130 and 120 px, saved as PNG, JPEG at quality 70, 50 and 35, and WebP3.2 to 4All scan

JPEG at quality 35 visibly smears the edges of the squares, and the codes still read every time. Compression was not what broke our code.

What actually breaks a QR code

  • Too few pixels per module. Our codes still read at about 3.2 pixels per module, and we would not go lower. A longer address makes this worse: our longer 16-character codes need a 33 × 33 grid, 41 modules with the border, so at 150 pixels each module gets only about 3.6 pixels. Those need about 180 pixels to be safe.
  • A cropped or missing white border. Image tools and designers often trim it as wasted space, or place the code on a coloured or busy background. The scanner uses the border to find the code.
  • A logo in the middle. It covers modules, and the code then relies on error correction to fill the gap. At small sizes that margin is gone.
  • Scanning a screen with a phone camera. Glare, angle and the screen's own pixels make it harder than reading the file, so a code that only just passes as a file may fail in real use.

What we changed

  1. Downloads at exact sizes: 150, 250, 512, 1024 and 2048 pixels, plus SVG, which stays sharp at any size. Each code is redrawn at the size asked for rather than stretched.
  2. 512 pixels as the default for social posts. It is sharp enough to be shrunk cleanly by any image tool, down to about 150 pixels in the final picture.
  3. The white border is always included, and extra padding to reach the exact size is added as more white border, never by cutting it.
  4. No logo option. We removed it. A plain code scans more reliably than a branded one that sometimes fails.
  5. Short codes by default. The random 8-character code keeps the grid at 29 × 29.

Rules for QR codes in posts and print

  1. Give each module at least 4 pixels in the final image. For a short web address, that is about 150 pixels wide on screen.
  2. Keep a white border of four modules on every side. Do not crop it.
  3. Start large. Download at 512 pixels or as SVG and let the design tool shrink it, not the other way round.
  4. Keep the address short. A short link gives a smaller grid that scans at smaller sizes.
  5. Dark on light, plain background. No gradients or photos behind the code.
  6. Skip the logo unless the code will be large.
  7. Point the code at your own short link if you can, so you can change the destination and count scans later.

If you need a small tool like this built, or an existing one tested against how it is really used, tell us what it has to do.

Written by

CrpyByte EngineeringEngineering team

The team that designs and builds CrpyByte client systems and tools. We write about the parts of the work worth writing down.

Have a process worth improving?

Let's build the system behind it. Tell us what the process is and where it breaks — the first conversation is about constraints, not technology.