General Utility · Tool
QR Code Generator
Generate a QR code from text, URL, or any payload. Pick foreground colour, background colour (or transparent), error correction level, margin and size. Returns SVG, base64 data URL, and ASCII preview.
Inputs
contentRequiredstringContent
required · default "https://toolsamurai.com"
Anything you want to encode. URLs, plain text, Wi-Fi credentials, vCards, UPI strings.
required · default "https://toolsamurai.com"
Anything you want to encode. URLs, plain text, Wi-Fi credentials, vCards, UPI strings.
error_correctionenumError Correction
default "M" · one of: L, M, Q, H
L ≈ 7% recovery · M ≈ 15% · Q ≈ 25% · H ≈ 30%. Higher = more robust but bigger QR. Use H for logos overlaid on the code.
default "M" · one of: L, M, Q, H
L ≈ 7% recovery · M ≈ 15% · Q ≈ 25% · H ≈ 30%. Higher = more robust but bigger QR. Use H for logos overlaid on the code.
foregroundstringForeground Colour
default "#0c0c0d"
Hex (#000000), rgb(), or any CSS named colour. The dark modules of the QR.
default "#0c0c0d"
Hex (#000000), rgb(), or any CSS named colour. The dark modules of the QR.
backgroundstringBackground Colour
default "#ffffff"
Hex, CSS colour, or the literal word "transparent" for no fill.
default "#ffffff"
Hex, CSS colour, or the literal word "transparent" for no fill.
margininteger (modules)Quiet Zone
min 0 · max 20 · default 4
Empty border in QR modules. Standard is 4. Set 0 for edge-to-edge.
min 0 · max 20 · default 4
Empty border in QR modules. Standard is 4. Set 0 for edge-to-edge.
sizeinteger (px)Size
min 64 · max 4096 · default 512
min 64 · max 4096 · default 512
formatenumOutput Format
default "svg" · one of: svg, png, jpeg, webp
svg = vector, infinite scaling, tiny file. png = lossless raster with transparency. jpeg = smaller, no transparency. webp = modern, smaller than png.
default "svg" · one of: svg, png, jpeg, webp
svg = vector, infinite scaling, tiny file. png = lossless raster with transparency. jpeg = smaller, no transparency. webp = modern, smaller than png.
Outputs
image_data_urlstringQR Code
svgstringSVG Source
asciistringASCII Preview
module_countinteger (×)Modules
qr_versionintegerQR Version
byte_lengthinteger (bytes)Payload Size
Example request
curl -X POST https://toolsamurai.com/api/v1/general-utility/qr-code-generator \ -H "Authorization: Bearer sk_free_•••••••••••••••" \ -H "Content-Type: application/json" \ -d '{ "content": "https://toolsamurai.com", "error_correction": "M", "foreground": "#0c0c0d", "background": "#ffffff", "margin": 4, "size": 512, "format": "svg" }'
Example response
{ "ok": true, "tool": "qr-code-generator", "domain": "general-utility", "version": "1.0.0", "result": { "image_data_url": "…", "svg": "…", "ascii": "…", "module_count": …, "qr_version": …, "byte_length": … }, "meta": { "latency_ms": …, "request_id": "req_…" } }