Mask pattern
To avoid big blobs of black or white modules, QR codes use a mask. There are eight different options.
Here's where the mask pattern is specified:
Black modules are a 1, and white boxes are a 0. In this case, the
mask pattern consists of the bits which
are the binary numbers 110. They correspond to
the decimal number 6.
There is a predefined pattern for each type. To better remember those patterns, you can use the following story.
Mask pattern story
| See, you have broken the law. I'm really sorry, but I see black for your future, you are going behind bars: | |
But then, things happen, a story enfolds. It follows
the black pixels moving from left to right, like
this: | |
| So, what happens? First , you get the cliché striped prison clothing. | |
| But you don't lose hope yet , and a rainbow helps you keep your spirit up. | |
Half time into your time in prison (the symmetric
codes:
and ), you start to have
hobbies: | |
| When you are alone , you paint, for example M.C. Escher's Lizards. | |
| Or you watch with your two eyes the games of chess the other inmates are playing. | |
| But the time drags on and you start to make break-out plans: You will cut your way out with an axe. | |
| And finally you manage to get out! This is the finishing line for your time in prison, so you get a chequered flag. | |
| And now, everything is bright and happy, like a flowered wall paper! | |
In our case, the pattern is the one that looks like part of a black-and-white rainbow!
If you repeat this pattern over the data parts of the QR code, you get this:
For each black module in the mask, you flip the module in the QR code! The next steps will show you how. We prepared a DIY zine that contains pre-made cheat sheets for all mask types! You can fold it into a little booklet, like this!
Encoding mode
Let's start decoding the content! First, we need to know the encoding of the content. That information is always given in the bottom-right corner.
But – remember! You first have to apply the mask! Let's look at our cheat sheet to see how.
Let's XOR the two boxes together:
Again, for each pattern, there's a different encoding mode.
| Numeric | |
| Alphanumeric | |
| Byte | |
| ECI (Extended Channel Interpretation) | |
| Kanji |
For our code, the encoding mode is Byte (4), so we can proceed!
Reading order
The content starts in the bottom-right corner. You go up, zig-zagging between two columns, and then zig-zag down the next to to the left. You always skip all special areas!
Bytes
The first four bits are the encoding mode. For the ASCII encoding mode, the next eight bits specify the content length. After that, every eight bits is a content byte.
And again, we have to apply the mask:
Decoding the length
This is the (unmasked) length information:
These are the bits: 00001100
These bits are in decimal: 12
This value is the total length of the content in bytes!
Decoding the content
And finally, we can proceed decoding the content of the QR code!
This is the first (unmasked) byte:
These are the bits: 01001000
These bits are in hexadecimal: 0x48
And this is the corresponding ASCII character: H
This is the second (unmasked) byte:
These are the bits: 01100101
These bits are in hexadecimal: 0x65
And this is the corresponding ASCII character: e
…and so on! The remaining bytes yourself are for you to practice on. You can stop when you've read the number of characters indicated by the length field previously.
ASCII table
You can use this table to translate the hexadecimal numbers into ASCII characters! You can also try to memorize parts of this table, if you're that kind of person: The lowercase letters start with an "a" at 0x61, and end at "z" with 0x7A. The ones in between you can count.
| …0 | …1 | …2 | …3 | …4 | …5 | …6 | …7 | …8 | …9 | …A | …B | …C | …D | …E | …F | |
| 0x2… | ␣ | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | / |
| 0x3… | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ? |
| 0x4… | @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O |
| 0x5… | P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _ |
| 0x6… | ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o |
| 0x7… | p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | DEL |
Error correction
So is the rest all content? Not quite! There is also error correction, which is used to make sure that the QR code can still be read even if some parts are damaged, blurry, or missing. The error correction is generated by some fancy math, and we don't care about it here for the purpose of reading it by hand.
Congratulations!
This should be everything you need to decode simple QR codes by hand. You can now either press the "Random code" button at the top to practice on short English words, or go find a QR code in the wild, and scan it using the "Scan code" button!