QRCGen API Documentation
Public API for generating ultra-lightweight SVG QR codes. Hosted on Cloudflare Workers with global edge caching.
Base URL: https://qr.qrcgen.com
Quick Start
https://qr.qrcgen.com/qr.svg?data=https://example.com
This returns a 302 redirect to a canonical, edge-cached SVG URL. The same input always produces the same URL — perfect for sharing and embedding.
Endpoints
GET /qr.svg — Share Link (redirect)
Best for sharing. Returns a 302 redirect to an immutable, edge-cached canonical URL.
| Param | Required | Default | Description |
|---|---|---|---|
data | yes | — | URL or text to encode (max 4,096 chars) |
p | no | sq250 | Size preset: sq125, sq200, sq250, sq300 |
ecc | no | M | Error correction: L, M, Q, H |
q | no | 4 | Quiet zone in modules (0–16) |
Example:
https://qr.qrcgen.com/qr.svg?data=https://example.com&p=sq300&ecc=H
→ 302 → /qr/sq300/a1b2c3...f0.svg
The canonical URL is deterministic: same parameters always produce the same hash. Once cached, responses are served instantly from the nearest Cloudflare edge location.
GET /qr.inline — Direct SVG (for embedding)
Returns SVG directly as a 200 response. No redirect. Ideal for <img> tags, Markdown, or anywhere you need the image immediately.
Same parameters as /qr.svg.
Example:
<img src="https://qr.qrcgen.com/qr.inline?data=https://example.com" alt="QR code" />
Edge-cached by full URL (24h TTL). X-QR-Cache: HIT|MISS header for diagnostics.
GET /qr/<preset>/<hash>.svg — Canonical URL
This is where share links resolve to. You don’t call this directly — use /qr.svg to get the redirect.
Response headers:
Content-Type: image/svg+xml; charset=utf-8
Cache-Control: public, max-age=31536000, immutable
ETag: "<hash>"
X-QR-Cache: HIT|MISS
Size Presets
| Preset | Dimensions | Use case |
|---|---|---|
sq125 | 125 × 125 px | Inline icons, small badges |
sq200 | 200 × 200 px | Cards, compact layouts |
sq250 | 250 × 250 px | Default — good for most uses |
sq300 | 300 × 300 px | Print, hero sections |
All presets produce square SVGs. The SVG viewBox uses module units; width and height are in pixels from the preset.
Error Correction Levels
| Level | Recovery | Best for |
|---|---|---|
L | ~7% | Clean digital display, maximum data density |
M | ~15% | Default — balanced for screen and print |
Q | ~25% | Printed materials that may get worn |
H | ~30% | Harsh environments, small print sizes |
Higher ECC means more redundancy, which makes the QR code denser (more modules) but more resilient to damage.
SVG Output
Every QR code is a single-line, optimized SVG:
- ~5 KB typical size (vs 80+ KB from other generators)
- One
<rect>(white background) + one<path>(black modules) - Horizontal run-length encoding:
M{x} {y}h{w}v1h-{w}z - Integer coordinates only — no floating point
shape-rendering="crispEdges"for pixel-perfect display- No
mask,clipPath,<g>, or unnecessary elements
Embed Snippets
HTML
<img src="https://qr.qrcgen.com/qr.inline?data=YOUR_URL" alt="QR code" />
HTML (object)
<object data="https://qr.qrcgen.com/qr.inline?data=YOUR_URL"
type="image/svg+xml" aria-label="QR code"></object>
Markdown

React
export function QR() {
return <img src="https://qr.qrcgen.com/qr.inline?data=YOUR_URL"
alt="QR code" loading="lazy" />;
}
Vue
<template>
<img :src="src" alt="QR code" loading="lazy" />
</template>
<script setup>
const src = "https://qr.qrcgen.com/qr.inline?data=YOUR_URL";
</script>
Caching
- Canonical URLs (
/qr/<preset>/<hash>.svg): cached for 1 year (immutable). Same hash = same content forever. - Inline URLs (
/qr.inline?...): cached for 24 hours by full URL. - Redirect URLs (
/qr.svg?...): not cached — always computes the redirect.
The QRCGen extension warms the cache automatically when you generate a QR code, so share links load instantly for recipients.
Rate Limits
No authentication required. No API keys. Generous limits for normal use.
Privacy
- No accounts, no cookies, no tracking
- No analytics on API requests
- QR data is used only to generate the image and compute the cache key
- The SHA-256 hash in canonical URLs is one-way — the original data cannot be recovered from the URL