Spartak Kagramanyan

Spartak Kagramanyan

Senior Full-Stack Engineer · Amsterdam

QR code generator for links

Your style, your colours, a logo in the middle. Made in your browser, never expires.

Drawing the code…

Pattern
Corners
Colours
In the middle
PNG, JPG, WebP or SVG, stays on your device

A QR code without a server, and why it never expires

A QR code is just your link written as a grid of squares, and turning text into that grid is plain arithmetic. This page does it in JavaScript, in your browser: the link, the colours and any image you add for the middle are never uploaded. Open your browser's network tab while you make one and you will see no requests.

Because the code holds the link itself, it works for as long as the link does. Many QR sites make "dynamic" codes instead, which point at a short link on their own server and redirect from there. Those let you change the destination later, but they stop working when the service shuts down or your plan ends, and they see every scan. A code from this page has no middleman.

How a logo fits without breaking the code

Every QR code carries spare data, called error correction, so a camera can read it with a scratch, a fold or a logo on top. There are four levels, which can rebuild 7, 15, 25 or 30 percent of the code. Without a logo this page uses 15 percent, which keeps the grid small. As soon as you add an image or letters it switches to 30 percent and clears the squares behind the logo, so the logo takes up only part of what the code can lose. Keep the logo at the default size or smaller, and scan the result with your phone before you print a thousand of them.

Making a QR code that scans everywhere

  • Dark code on a light background. Most cameras also read the reverse, but some older ones do not, and low contrast fails everywhere. The page warns you when the colours are too close.
  • Keep the empty margin around the code. It is four squares wide and part of the code: crop it off, or put the code on a busy photo, and scanners lose track of the corners.
  • Shorter links make fewer, larger squares, which scan from further away and at smaller print sizes. Strip tracking parameters you do not need.
  • For print, download the SVG. It stays sharp at any size. A rough rule is one centimetre of code for every ten centimetres of scanning distance, and never under two centimetres.

Generate a QR code in code

JavaScript and Node, with the qrcode package on npm:

import QRCode from "qrcode";

await QRCode.toFile("qr.png", "https://example.com", { errorCorrectionLevel: "M" });
const svg = await QRCode.toString("https://example.com", { type: "svg" });

Python, with qrcode (pip install "qrcode[pil]"):

import qrcode

qrcode.make("https://example.com").save("qr.png")

The encoding on this page uses qrcode-generator by Kazuhiko Arase, under the MIT licence; the styles and logo are drawn on top of it here. QR Code is a registered trademark of DENSO WAVE. More small utilities live on the tools page, including a password generator.