mikepk.com about current projects contact

Create 2D QR Barcodes

March 11, 2010

SnapMyInfo now has a simple page to allow you to generate QR codes to experiment with. There seems to be growing interest in these kinds of two dimensional barcodes, so I thought it would be fun to allow you to generate barcodes based on arbitrary text and not just snap codes.

This isn't the internal SnapMyInfo Barcode generator. While surfacing the internal barcode generator used by SnapMyInfo wouldn't have been too hard, I often tweak the generator and didn't want people to have to depend on this external service if I ever decided to modify the barcode output in any way. While poking around the Google Charts API a few months back, I noticed they now have support for generating QR codes. This page is basically a simple front end for generating QR codes using Google's service. Simply input any text you want (up to 512 characters) and you'll get a barcode image in return. These barcodes contain text but by using certain text patterns you can tell some barcode readers to do special things with them.

Barcodes as Physical Links

If you create a barcode comprised solely of a URL, including the 'http://' like http://snapmyinfo.com/ many barcode readers are designed to interpret the barcode as a link. That means they will, if a web browser is available, automatically take you to the site contained in the barcode.

Telephone numbers

Starting the text with the prefix TEL: instructs the barcode reader that this is a phone number. In many cases a smartphone will dial the number contained in the barcode when it is decoded.

Automatic Email

You can embed an automatic email message in a QR barcode. I've found this to be relatively uncommon, but the pattern is SMTP:[email address]:[subject]:[message]. Some barcode readers treat this pattern in a similar way to the 'mailto' url protocol in web browsers, creating an email in the smartphone's email application ready to send.

Example: SMTP:[email protected]:Hello:Greetings to SnapMyInfo

Automatic SMS

SMSTO:7812189522:Greetings to SnapMyInfo!
This one also isn't as common, but you can create a barcode with the following pattern: SMSTO:[cell number]:[message].

For example, the barcode to the right sends an SMS to TenZeroLab. If your smartphone's barcode reader understands SMSTO then the barcode will automatically create a text message.


The barcode can contain a "vcard" as well. vCards are a standard format that's often used for sharing contact information. This isn't something you'd typically type directly into a barcode generator, but it does work. A typical vcard in a barcode might look like the following:

Boston Massachusettes!
Sometimes the vcard standard is also used to embed geographic coordinates in the QR code as well. The pattern looks the same except that a GEO: heading is included with latitude and longitude values.

N:;Boston, MA


There are a few other text patterns that are interpreted by various barcode readers not included in the above list, but these seem to be the most common.

I'm curious how people will experiment with this and what fun and interesting uses people will find.