Skip to content
UseQR
ESC

↑↓ MOVE↵ OPEN48 PLACES

Developers & agents

QR codes in LaTeX

Load the qrcode package and \qrcode[height=2cm]{https://example.com} draws a pure-vector code with LaTeX's own drawing commands — no external images, no shell-escape, and it prints at any size without pixelation. Set level=H for logos, keep the quiet zone, and size beamer codes for the back row.

View as MarkdownPaste this page into any AI assistant — it is plain, portable Markdown.

The qrcode package

\usepackage{qrcode}
...
\qrcode{https://example.com}
\qrcode[height=2cm]{https://example.com}
\qrcode[height=2cm, level=H]{https://example.com/paper}

What makes this package the right default: it encodes and draws the code inside TeX, using native drawing primitives. The output is pure vector — no image file, no shell-escape, no network — so the code stays razor-sharp at any print size, which is the same reason print work wants SVG elsewhere.

Useful options:

Option Meaning
height=2cm rendered size (width equals height)
level=L|M|Q|H error-correction level
version=5 force a symbol version
padding draw the surrounding quiet zone as part of the symbol
nolinks do not make the code a clickable hyperlink

Two of those deserve expansion. padding guarantees the 4-module quiet zone travels with the code — without it, a code placed against a coloured box or margin note can end up with no clear border and fail to scan. And when hyperref is loaded, the drawn code is itself a hyperlink in the PDF — a genuinely nice touch for documents read on screen — with nolinks to opt out.

Set document-wide defaults once:

\qrset{height=2cm, level=M, padding}

Sizing: print vs projection

For a code on paper scanned at arm's length, height=2cm sits at the practical print floor of 2 × 2 cm. For a beamer slide the arithmetic changes completely: the reader is metres from a projection, and the 10:1 rule applies — minimum code width ≈ viewing distance ÷ 10. A seminar room where the back row sits 8 m from the screen needs the code to be ~80 cm wide as projected, which on a standard 16:9 frame means the code occupies roughly a quarter of the slide width. The full working is in QR size on a TV screen. Leave the slide up for a sensible interval too — people need time to raise a camera.

The includegraphics route

If you need styling the package cannot draw (brand colours, custom modules), generate a vector file from the keyless API and place it like any figure:

curl -o qr.svg "https://useqr.app/api/v1/qr?data=https://example.com&format=svg"
rsvg-convert -f pdf -o qr.pdf qr.svg
\includegraphics[width=2cm]{qr.pdf}

pdfLaTeX cannot read SVG directly, hence the PDF conversion step (rsvg-convert, Inkscape, or svg2pdf all work). Anything styled should be verified before the camera- ready deadline — GET /api/v1/verify with the same parameters reports whether the code still decodes.

FAQ

How do I put a QR code in a LaTeX document?

Load the qrcode package and write \qrcode[height=2cm]{your-url}. The code is drawn as vector graphics by TeX itself, with no external tools.

Is the LaTeX qrcode package output print-quality?

Yes — it is pure vector, so it cannot pixelate. Keep the height at 2 cm or more for close-range scanning and preserve the quiet zone with the padding option.

How big should a QR code be on a beamer slide?

Use the 10:1 rule against the projection: viewing distance divided by ten. For a back row 8 m away, the projected code needs to be about 80 cm wide.

Can I use a coloured or logo QR code in LaTeX?

The package draws plain black codes. For styled ones, download an SVG from the keyless API, convert to PDF, includegraphics it, and verify it still decodes.

Try it — free, no signup

  • A free QR code API with no keyUseQR's REST API needs no signup, no API key and no SDK. GET /api/v1/qr?data=hello returns a PNG. The shortest form is /q/hello.png, which drops straight…
  • QR codes in markdownOne line of markdown puts a QR code in any README or docs page via useqr.app/q/hello.png. Encoding rules, sizing, and when to commit the image.
  • Why you should print QR codes from SVGVector QR codes rasterise at the press's native resolution with exact module edges. The PNG-resample chain is how codes that looked sharp on screen die in print.
  • QR code size on a TV screenSofas sit 2–4 m from the panel, so the code needs 20–40 cm of physical screen — a quarter of a 55-inch TV's width. The percentage arithmetic by screen size.