Generating QR Codes (2D Barcodes)

A client of ours asked for some simple instructions for creating those 2D barcodes that you are starting to see in off-line promotional materials, product tags, etc. Specifically, they want to have the user go to a URL when the code is scanned by a smartphone (a camera phone).

There are many ways of creating these codes. There are many types of 2D barcodes. There are many websites and programs for generating the codes, and a gazillion downloadable apps for reading them. It can be a complicated area.

But let’s make a simple scenario for this client. They want to send users to a predetermined page on their website where details of a promotional offer will be made available.

There are four types of 2D barcodes: QR code, DataMatrix, Microsoft Tag and ScanLife EZcode. The most popular type seems to be QR codes, and this is what we’ll suggest for this client. In addition, you can embed text, a URL, an SMS mobile number, and many other things within a QR code. This client wants a URL that the smartphone’s app will recognize and take the user to.

There are many QR code generating websites such as QRstuff.com where you can select “Website URL”, paste in your URL, and have the code instantly generated. Then just save it to your local workstation. It is free, but also has additional features available if you get a paid account.

Beware of long URLs. The size of the small squares within a QR code will decrease as more content is stuffed into the QR code. So, the longer the URL you use, the smaller the small squares become within the resulting QR code. This affects readability of the QR code in a variety of low quality smartphone cameras. If you have a long URL, QRstuff.com has a built-in URL-shortener that you can use, or you can run the long URL through your URL-shortener of choice such as Bit.ly, etc. and insert the shortened URL into the QR code generator.

Whitespace is needed around the four sides of the generated QR code. Some generators will automatically generate an adequate amount of whitespace around the code (e.g. the whitespace should be the size of about 4 of the small squares within the generated QR code, or some people just use a 1/4-inch to be sure). The more whitespace, the easier it is for reader apps to detect the QR code.

What size should you make the QR code? A QR code that is not readable by low quality cameras in certain smartphones will kill the effectiveness of any campaign. A code which is smaller than 1-inch-by-1-inch (2.5 x 2.5 cm) and which contains too much content (e.g. a long URL), will probably not work on a variety of readers. There are formulas to help estimate the size of the QR code based upon the maximum distance you want users to be away from the code’s surface (e.g. is this on a magazine ad or on a billboard), the lighting, the quality of the camera, etc.

Testing: Once you have your perfect QR code generated, print it and attempt reading it with a variety of smartphones (e.g. BlackBerry, iPhone 3GS, iPhone 4, Android phones, etc.) and with a variety of barcode reader apps. This is the only way to see how “perfect” your QR code is, and besides, now is the time to tweak it if there are readability issues, before you actually use it with potential customers. Testing is critical: test, test and test.

So for this client, who wanted the QR code printed on promotional flyers, they went with a shortened URL, and a 1.25 inch square code with lots of whitespace around it.

This approach worked for this client. Your mileage may vary.

Bonus: How do you know if your URL is too long? This gets a bit complicated. If you experiment with generating a variety of QR codes using different lengths of content, you will notice that as the content length increases, the size of the black and white squares within the resulting QR code get smaller. With the least amount of content, there are 21 rows x 21 columns of small squares within the QR code. As the content (URL) length increases, the size of these squares decrease and the quantity of rows increases, 4 rows at a time (e.g. 25 x 25 rows, then 29 x 29 rows, etc.). If you look closely at the generated QR code and count the number of rows, it is good to keep the number of rows at 33 x 33 or less. This will make the codes more readable for lower quality camera phones.