Google Chart API QR Code Replacement

Google's QR code URLs on chart.googleapis.com now return a 404. Change the hostname to useqrkit.com, keep every parameter, and your QR code images work again.

Free, no API keySame parametersGET or POSTPNG output

Before (broken)

https://chart.googleapis.com/chart?cht=qr&chs=180x180&chl=https%3A%2F%2Fuseqrkit.com

After (works)

https://useqrkit.com/chart?cht=qr&chs=180x180&chl=https%3A%2F%2Fuseqrkit.com

QR code drawn by the useqrkit.com/chart endpoint

That URL, live

The fix

Swap the Hostname, Keep the Rest

Find the start of the old URL in your code, template or spreadsheet and replace it. Everything after the question mark stays the same.

ReplaceWith
https://chart.googleapis.com/chart?https://useqrkit.com/chart?
https://chart.apis.google.com/chart?https://useqrkit.com/chart?
https://www.google.com/chart?https://useqrkit.com/chart?

Fixing a spreadsheet? The Excel and Google Sheets QR code guide walks through the formula, the Allow access prompt in Sheets and Excel's limits.

Reference

Parameters

These are Google's QR code parameters, with Google's meanings. Send them in the query string of a GET request, or as a form-encoded or multipart POST body, which Google also accepted for data too long for a URL.

ParameterWhat it does
chtRequired. Must be qr. Other Google chart types are not served.
chlRequired. The text or link to encode, URL-encoded.
chsImage size in pixels, such as 300x300. Up to 1,000 per side and 300,000 pixels in total, as Google allowed. Left out, it is 200x200 (Google returned an error).
chldError correction level and quiet zone, such as H|1. The level is L, M, Q or H; the margin is in modules. Left out, it is L|4.
choeText encoding: UTF-8 (the default) or ISO-8859-1.
  • The answer is a PNG with the code centred on a white canvas of exactly the size you asked for. If that size is too small for the data, the canvas grows so the code stays scannable.
  • A mistake gets a 400 response with a one-line plain-text reason, such as Missing chl: the text to encode.
  • GET images are cached for a year, because the same URL always draws the same code. POST responses are never cached.

Examples

Use It From Any Language

URL-encode the value you put in chl, or a link with & or # in it gets cut off at that character.

HTML

<img src="https://useqrkit.com/chart?cht=qr&chs=300x300&chl=https%3A%2F%2Fexample.com"
     width="300" height="300" alt="QR code for example.com">

JavaScript

const src = "https://useqrkit.com/chart?" +
  new URLSearchParams({ cht: "qr", chs: "300x300", chl: link });

PHP

$src = 'https://useqrkit.com/chart?' .
  http_build_query(['cht' => 'qr', 'chs' => '300x300', 'chl' => $link]);

Python

from urllib.parse import urlencode

src = "https://useqrkit.com/chart?" + urlencode({"cht": "qr", "chs": "300x300", "chl": link})

Google Sheets or Excel

=IMAGE("https://useqrkit.com/chart?chs=300x300&cht=qr&chl="&ENCODEURL(A1))

POST, for long data

curl https://useqrkit.com/chart -d cht=qr -d chs=300x300 \
  --data-urlencode "chl=https://example.com/a/very/long/link" -o qr.png

Before you switch

What This Endpoint Is and Is Not

Good for

Old tutorials, plugins and templates that build QR images from a URL; a QR code next to each row of a spreadsheet; quick codes in emails, invoices and internal tools.

Not for

Secrets. The text travels to our server inside the image address, as it did to Google's, so keep Wi-Fi passwords and two-factor setup codes out of it. Make those with a QR library in your own app.

Need barcodes too? The free barcode API works the same way for Code 128, EAN, UPC, Data Matrix and more. For codes with colors and a logo, or codes you can edit and track after printing, use the QRKit QR code generator.

Google Chart API QR Code: FAQ

Writing a tutorial that uses this endpoint? A link to this page helps the next reader whose QR codes stopped working find the fix.