Latest release

Development edition

You can find the development edition at github.


Libqrencode is a fast and compact library for encoding data in a QR Code symbol, a 2D symbology that can be scanned by handy terminals such as a mobile phone with CCD. The capacity of QR Code is up to 7000 digits or 4000 characters and has high robustness.

QR Code example

Libqrencode accepts a string or a list of data chunks then encodes in a QR Code symbol as a bitmap array. While other QR Code applications generate an image file, using libqrencode allows applications to render QR Code symbols from raw bitmap data directly. This library also contains a command-line utility outputs QR Code images in various formats.


Libqrencode supports QR Code model 2, described in JIS (Japanese Industrial Standards) X0510:2004 or ISO/IEC 18004. Most of features in the specification are implemented such as:

Currently the following features are not supported:



While the command-line utility and some test programs use libpng or SDL 2.0, the libqrencode library itself has no dependencies. You can skip compiling tests and/or tools if you want not to install programs using SDL or PNG.

Compile & install

Just try

sudo make install
sudo ldconfig

This compiles and installs the library and header file to the appropriate directories. By default, /usr/local/lib and /usr/local/include. You can change the destination directory by passing some options to the configure script. Run "./configure --help" to see the list of options.

It also installs a command line tool "qrencode" to /usr/local/bin. If you want not to build it, give "--without-tools" option to the configure script.

When you downloaded the source code from github, run "" at first to generate configure script.

If the configure script does not work well, try to use CMake.

cmake .

When you want to build the test programs, give "--with-tests" option to configure, or "-DWITH_TESTS=YES" to cmake.


Basic usages of this library are written in the header file (qrencode.h). You can generate a manual of the library by using Doxygen.

Generated manual


The library is distributed WITHOUT ANY WARRANTY.

Micro QR Code support is EXPERIMENTAL.

Be careful to use the command line tool (qrencode) if it is used by a web application (e.g. CGI script). For example, giving "-s" option with a large number to qrencode may cause DoS. The parameters should be checked by the application.


Copyright (C) 2006-2017 Kentaro Fukuchi

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA


Visit this page ( for new releases.

The git repository is available at:

Please mail any bug reports, suggestions, comments, and questions to:

Kentaro Fukuchi

or submit issues to:


QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other countries.

Reed-Solomon encoder included in this library is originally taken from FEC library developed by Phil Karn (KA9Q) and distributed under the terms of the GNU LGPL, then rewritten by Kentaro Fukuchi. Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q

Please see for the full list of contributors.


The following bindings are not included in the package of libqrencode. Please follow the instructions of them to install.

Libqrencode is ported to the following systems:




Version 4.0.0 (2017.9.21)

Release Note: While the API has not been changed since the previous major release, we incremented the major version number of libqrencode to 4 because the implementation of the library has been largely changed.

This release improves the performance and memory footprints of code generation.

Now you can build libqrencode with CMake.

If you build the test programs, please note that the required SDL version has been changed from 1.2 to 2.0.

Version 3.4.4 (2014.7.24)

Release Note: When only one symbol is generated in structured-append mode, the library had inserted unnecessary chunk to the symbol and some QR Code readers fail to read it. Now the library omits the chunk and generate a symbol identical to non- structured symbol.

Version 3.4.3 (2013.8.12)

Release Note: This release contains a couple of bug fixes and a new minor feature of the command line tool. Some minor bugs in the library have been fixed.

Run Length Encoding (RLE) for SVG output decreases the size of the output file, but it makes complicated to edit the image by SVG editors. A newly introduced command line option "--rle" enables RLE. RLE will not be applied if it is not given.

Version 3.4.2 (2013.3.1)

Release Note: Micro QR Code encoder had a bug that caused incorrect output (issue #25). Now the bug has been fixed. Memory leak bug (#24) and insufficient string splitting bug have been fixed.

Version 3.4.1 (2012.10.17)

Release Note: Mutual exclusion did not work correctly since 3.3.1. If your application uses libqrencode in multithreaded environment, it is strongly recommended to update it.

Version 3.4.0 (2012.10.15)

Release Note: Three new output format, SVG, UTF8, and ANSIUTF8 have been added to the command line tool. UTF8 and ANSIUTF8 are another text art mode, using Unicode block elements for high-resolution text output. Long-awaited colored QR code has been introduced. Try "--foreground" and "--background" options to set the colors. Currently PNG and SVG supports colored output.

Version 3.3.1 (2012.4.18)

Version 3.3.0 (2012.4.1)

Release Note: Three new output format, EPS, ANSI, and ASCII text, have been added to the command line tool. ANSI and ASCII mode ignore "-size" option. Give "-t ASCIIi" to get an ASCII-mode symbol in inverted color.

QRcode_APIVersion() is requested by Matthew Baker for better support of Python ctypes binding. Check them out at

Version 3.2.1 (2012.4.1)

Version 3.2.0 (2011.11.26)

Release Note: Binary data including '\0' is now supported. To encode a binary data, give "-8" option to qrencode, and let qrencode obtain data via standard input like "qrencode -8 -o output.png < binary". "--dpi" and "-d" are also added to embed DPI information to PNG file.

A bug in the mask pattern evaluation routine has been fixed. In some cases, libqrencode may generate a different symbol from the one that was generated by the prior libqrencode because of this bug fix, but the embedded data are not affected. The symbols generated by the old libqrencode are valid.

Experimental support of Micro QR Code encoder has been added. Some functions (QRcode_*MQR()) have been added to the library. The command line tool generates Micro QR Code when "--micro" or "-M" is given.

Version 3.1.1 (2010.2.3)

Release Note: Libqrecode had generated incorrect QR Code in some cases. Symbols larger than version 5 (error correction level Q and H) were affected. In many cases this bug did not cause serious damage thanks to the error correction mechanism, but we highly recommend you to encode symbols again using this release.

Version 3.1.0 (2009.6.6)

Release Note: This release focuses on the code cleanup and performance improve. Encoding time has been improved, drastically in large symbols. Basically this update only changes its internal code. The API is not changed, no need to recompile user applications that includes only qrencode.h. If your application refers the internal data representation (not recommended), see ChangeLog for further information.

Version 3.0.3 (2008.6.1)

Release Note: This release improves the portability of our command line tool "qrencode". The library is not changed so that any applications using libqrencode are not affected.

From this release, qrencode accepts "long" options, such as "--help". See the manpage for the detailed instructions.

Qrencode now uses getoptlong() instead of getoptlongonly() which is not available in some operating systems. If the getoptlong() is not provided or the implementation of it is not compatible with GNU's one, please try qrencode-3.0.3-gnulib, that contains the source code of the getopt_long(). Gnulib version is a test release. If you feel happy with it, please let us know and the future releases will include gnulib.

Version 3.0.2 (2008.5.18)

Version 3.0.1 (2008.5.9)

Version 3.0.0 (2008.4.30)

Release Note: Now libqrencode supports "structured-append" of symbols. A large data set can be split into multiple QR code symbols. The basic usage of structured-append is not so different from the single symbol encoding: just call QRcodeencodeStringStructured() or QRcodeencodeString8bitStructured() and they return a list of symbols. Instead of giving a string, you can encode an explicitly typed data. See the manual generated by Doxygen for the detailed usage.

Many thanks to Yusuke Mihara, who contributed a patch to add support of structured-append to version 1.0.2.

API changes:

Version 2.0.0 (2008.1.24)

Release Note: Previously libqrencode encodes lower-case alphabet characters in Alphabet- Numeric mode (upper-case alphabet and numeric) by default. According to the specification of QR code, however, it is clearly claimed that Alphabet-Numeric mode provides only upper-case alphabet (+ numeric and some symbol) characters. Since this version, libqrencode distinguishes lower-case and upper-case of alphabet characters by default. Because of that, "-c" option of qrencode is now deprecated, and "-i" option has been added. By giving "-i", qrencode converts lower-case characters to upper-case if possible, then encode a QR code symbol. Please read qrencode.h for the details about API changes if you are going to use this library.

Many thanks to NANKI Haruo for his suggestions.

Version 1.0.2 (2007.03.24)

Version 1.0.1 (2006.12.27)

Version 1.0.0 (2006.12.12)