Try my QR Code Generator.

QR Code Tutorial

Welcome to my QR Code tutorial. QR codes are a special type of barcode created by Denso Wave Incorporated. They encode text and numbers using a pattern of pixels that is designed to be easy for optical scanners to read.

The tutorial that you are reading is designed to teach programmers how to encode information in a QR code. As such, it is recommended that you only read this tutorial if you already have at least a basic grasp of programming concepts.

Please check out my QR Code Generator if you just want to create a QR code.

Introduction →


April 3, 2013 - The entire tutorial has been updated to be much more accurate and comprehensive. I hope that this new version is a big improvement over the old one. Please contact me with any corrections, questions, or comments.

March 28, 2013 - The show division steps page has been updated with a new format that I hope is a significant improvement over the previous version. I am aware that the previous version gave incorrect results in certain situations. The new version should provide correct results in all situations. Please contact me if you encounter any problems.

February 27, 2012 - I received a question about how to create generator polynomials. I had been planning to add a page that shows each step, but it took me a while to finish. Here is the new page: how to create generator polynomials.

January 9, 2012 - I received a report of a bug in my QR code generator. I had been aware of the bug for some time, but was unable to pinpoint the source of the problem. With the information from the bug report, I was finally able to determine the cause of the problem, which is explained below.

During the polynomial division step of error code generation, each time an XOR is performed, the leading coefficient will be XORed to 0, and should be removed from the polynomial. However, there is a chance that more than one of the leading coefficients will become 0. All such leading 0 terms should be removed before continuing to the next step of polynomial division, but my QR code generator was incorrectly only removing the first 0 term.

I have updated the QR code generator, the show division steps page, and part 2: error correction to reflect the correct information for this step. Many thanks to the submitter of the bug report.

December 20, 2011 - I have made many additions and edits to part 3, choosing the best mask pattern. I have added information that was missing, and have attempted to clarify parts that seemed unclear. It now includes how to add the type information bits, the version information bits, and how to calculate the four penalty scores.

December 14, 2011 - I received a suggestion to show the steps of error correction generation in part 2. I updated part 2 to show every step of the polynomial division from start to finish.

I also discovered an error in the tutorial. If an exponent becomes greater than 255, you should NOT use modulo 256 on it. The correct modulo to perform is 255. I apologize for any confusion that this might have caused.

If you would like to see the division steps for a different message polynomial and desired number of ECC blocks, please visit the show division steps page.



Creative Commons License's QR Code Tutorial by Carolyn Eby is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
QR Code is registered trademark of DENSO WAVE INCORPORATED.
Page last updated 2014-11-28T02:11:32+01:00