Say it with a QR code writes a whole message into the code itself. This page is about the next step: showing one of those codes on your own website, so your visitors see it without ever coming here first.
There are three ways to do it, and the first one is a single line of HTML.
What you are embedding is a picture. Your page asks our server for an address, and the server draws a QR code from what is in that address and sends back an SVG. There is no script to load, no key to get, no account, and nothing to keep up to date. It works in a site builder that strips JavaScript, in an email template, in a README and in a PDF.
1Make the code first
Open the composer, write your message and set it up the way you want it — the typeface, the colour, the emoji in the middle. Everything you choose there travels inside the address, so the embed looks exactly like the preview.
Then scroll to the bottom and open “Put this QR code on your website”. It hands you the three snippets below, already filled in with your own message.
On a phone that panel is not there, and it says so instead. Nobody pastes an image tag into their CMS from a handset, so a phone gets one line pointing at a computer rather than a code block it cannot use. If you are reading this on a phone, the rest of the page still works — come back for the snippets.
2As an image
The one most people wantOne tag. It works everywhere, it loads nothing of ours into your page, and the picture is an SVG, so it stays sharp at any size on any screen.
That picture is the embed. It was fetched from this server a moment ago by exactly the tag below — it is not a screenshot. Point a phone at it and you will land on the message.
…
Two details worth knowing about that tag:
widthandheightare the browser’s, not ours. They reserve the box before the picture arrives, so your layout does not jump. Change them freely — see how big to draw it below.altmatters more here than on a decorative image. A QR code is unreadable to anybody using a screen reader and to anybody whose pictures did not load, so say what is in it.
3As a frame
The same picture, inside a small page of ours. Use this one if you would like the code to be clickable on its own — a visitor who cannot scan it, because they are already on the phone, can tap it instead.
This one is a real frame, served by
/qrframe on this domain. It carries no advertising and no
usage measurement.
…
A frame runs a script of ours on your page, and the image version does not. The frame loads our device-detection script in your visitors’ browsers. That is the whole difference between the two, and it is the reason to pick the image unless you want the link.
Section 1.7 of our privacy notice sets out what we receive either way and what we keep. Your own notice is yours to write.
4A different code for every visitor
The address is just a string, so you can build it yourself — with a name, an order number, a table number, a seat. There is nothing to include and no library to add: everything except the words keeps the card looking the way you set it up.
…
And this is the part that goes wrong
If you rebuild the address while somebody is typing, every
keystroke is a new address, and every new address is a new request.
Type a twelve-character name into a field wired straight to
img.src and you have asked our server to draw twelve QR codes
to show one.
Wait until they stop. Try it — the slider is the pause, and the counters are real:
Drag the slider to 0 and type a word. Then put it back to 300 and type the same word again.
“Already seen, so free” counts the addresses this page had asked for before. Your browser serves those out of its own cache without touching the network, because the answer to a given address never changes — see the rules.
There is a budget behind this, and the pause is how you stay
inside it. Each visitor’s own address may ask for
240 pictures in a burst and about 8 a second after that
— which is roughly the rate a fast typist produces with no pause at
all, so a page that waits even 200 ms will never come close. Over
that, the server answers 429 and your visitor sees a picture
that did not load.
Two things worth knowing about the number. It is per address, so everyone behind one office or mobile network shares it — another reason the pause is worth having even when your own traffic looks small. And it is a limit on asking: an address your visitor’s browser has already fetched is served from their own cache and costs nothing at all, which is the whole point of the rules.
Say what should happen if a picture does not
arrive. That is true of any image on anybody’s site — a
network drops, a request is refused — and an <img>
with nothing to say about it leaves a broken icon in your layout. One
attribute is enough:
…
5How big to draw it
Big enough that a phone can read it, and the number that decides this is not the width of the picture — it is how wide one little square is. A long message needs more squares in the same box, so the same 150 pixels that are generous for Marry me? can be too tight for a paragraph.
Making it bigger is free. The size parameter
sets only the picture’s declared width and height; the drawing inside
is the same vector either way. So you can also just enlarge it in CSS: the
picture your browser already has is reused, nothing is fetched again, and an
SVG stays sharp however far you push it.
Try a message and a size. The numbers under the picture are measured from the code this server actually drew, not from a table.
…
…
As a rule of thumb, on a screen at the usual 96 pixels to the inch:
| One square measures | What that means in practice |
|---|---|
| under 0.5 mm | Tight. It will scan, but the phone has to come close — and somebody across the room from a monitor will give up. |
| 0.5 to 0.7 mm | Fine for a code somebody holds a phone up to. |
| over 0.7 mm | Comfortable, including from a step or two back. |
Two levers, in the order they cost you anything. Draw it bigger — free, as above. Write less — a shorter message is genuinely fewer squares, which is the only way to make the code itself simpler.
If you are printing rather than showing on a screen, work in millimetres on the page and ignore the pixel figure entirely; the square size is still the thing to watch.
6Everything you can put in the address
All of it is optional except the words. Leave one out and you get the default; put a number outside its range and it is brought back into range rather than refused, so a stray character in a field that only picks a typeface never costs somebody a broken picture.
| Name | What it is | Default |
|---|---|---|
sentence |
The message, up to 600 characters. URL-encode it. | — |
t |
A code the composer already built, with the look packed inside
it. Use this or sentence, not both —
t wins. |
— |
f |
The typeface, 0–18, in the order
the composer lists them. |
0 |
g |
The background colour, 0–33. |
0, white |
ink |
The lettering colour, from the same list of colours. Left at zero, a readable one is chosen for you against the background. | 0, automatic |
emoji |
The badge in the middle. Write the character itself, or
U+1F600, or 0x1F600, or the decimal
codepoint. e also works. |
none |
fs |
How big the words are on the card,
2–7. |
4 |
pd |
How much space is around them,
2–12. |
6 |
al |
How the words line up: 0 centred, 1
left, 2 right. |
0 |
size |
Width and height of the picture in pixels,
64–2048. Leave it out and the
picture has no size of its own, so your CSS decides. |
none |
short |
1 to carry our short address instead of the long
one, which is fewer squares for the same message. Only on the
live site. |
off |
loose |
1 to lower the error correction, which also makes
the code simpler. Think twice for anything printed
— the extra correction is what survives a crease, a smudge
or a sticker over the corner. |
off, full correction |
Try it
Change anything and the address below changes with it. The picture is fetched fresh each time — which is exactly the behaviour section 4 is about. The card beside it is the reader page itself, opened on the very address shown below — that is where the typeface, the background, the word size and the spacing go. It is also why those four rearrange the squares without ever adding any: they ride in bytes the code already carries, so only the message itself makes a code denser.
…
7Four things that will not change
- The code always opens this site. There is no setting for where it leads. The address is built on our server out of your words, so an embedded code can only ever open the card you made — it can never be pointed somewhere else, by you or by anybody who finds the tag.
- The same address always draws the same picture. The answer is a pure function of what you asked for, so it is cached for a week and marked as never changing. Your visitors’ browsers, and any proxy between them and us, will serve it without asking again.
- One request per address. The corollary of the line above: a new address is a new request, a repeated one is free. That is the whole of section 4.
- The message is not stored anywhere. It travels inside
the code, and the part of a web address after the
#is never sent to any server — so the person who scans it reads your message without us ever seeing it. Drawing the code does need the words, which is what the request from your page carries; we draw it and keep nothing.
What your visitors send us. Showing the code means their browser asks our server for it, so we receive that request as any website receives a request for a picture it serves — and the frame version runs our device-detection script for them as well. Section 1.7 of our privacy notice says what that involves, what we receive and what we keep.