Python QR code libraries

Updated Nov 2026

Python QR code libraries encode text or a URL as a QR code and write it out as an image, a vector file, or terminal text. An encoder builds the grid of dark and light modules before a serializer draws it. These libraries let apps print payment links, tickets, and sign-in codes that a phone camera can scan.

Popularity

qrcode has the most monthly downloads in this comparison, at 36.3M.

LibraryMonthly downloadsStarsLast releaseLicense
qrcode
36.3M
5.0KMay 2025BSD
Segno
12.0M
823Mar 2025BSD-3-Clause
PyQRCode
1.6M
428Jun 2016BSD-3-Clause
Treepoem
48.6K
165Sep 2026MIT
qrcodegen
27.4K
6.8KApr 2022MIT
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Creates QR symbols with configurable image factories and styled module rendering.

Downloads / mo
36.3M
Stars
5.0K
Last release
8.2
License
BSD

Strengths

  • Provides PNG and SVG factories. Render raster images or scalable vectors from the same QR generation API.
  • Supports styled QR modules. Customize module shapes, colors, and embedded images through image factories.

Limitations

  • Styled codes need reader testing. Check styled output with target readers before using it in a product.
  • Appending data preserves previous content. Clear the QR object before replacing its payload.

Quickstart

From README.rst
$ pip install "qrcode[pil]"
import qrcode
image = qrcode.make('Hello, world!')
image.save('qr.png')

qrcode examples

From open-source projects on GitHub

Creates QR and Micro QR symbols with dependency-free vector and raster serializers.

Downloads / mo
12.0M
Stars
823
Last release
1.6.6
License
BSD-3-Clause

Strengths

  • Generates Micro QR symbols. Create compact symbols or explicitly require standard QR output.
  • Exports without image dependencies. Write SVG, PNG, and PDF using the included serializers.

Limitations

  • Small payloads can become Micro. Use make_qr or micro=False when the receiving system requires standard QR.
  • Error correction can increase automatically. Disable boost_error when the selected error correction level must remain unchanged.

Quickstart

From README.rst
$ pip install segno
import segno
qr = segno.make_qr('Hello, world!')
qr.save('qr.png', scale=5)

Segno examples

From open-source projects on GitHub

Generates QR codes in pure Python with SVG, EPS, PNG, and terminal output.

Downloads / mo
1.6M
Stars
428
Last release
1.2.1
License
BSD-3-Clause

Quickstart

From moddoc.html
$ pip install pyqrcode
import pyqrcode
qr = pyqrcode.create('Hello, world!')
qr.svg('qr.svg', scale=4)

PyQRCode examples

From open-source projects on GitHub

Renders QR and other barcodes through BWIPP and Ghostscript, returning Pillow images.

Downloads / mo
48.6K
Stars
165
Last release
3.29.0
License
MIT

Strengths

  • Handles several barcode symbologies. Use the same renderer for QR, Aztec, and linear barcode formats.
  • Returns images for further composition. Add borders or combine the generated Pillow image with other graphics.

Limitations

  • Requires external Ghostscript. Install the Ghostscript executable alongside the Python package.
  • Options follow the barcode engine. Pass barcode-specific BWIPP options rather than the other libraries’ QR keyword arguments.

Quickstart

From README.rst
$ pip install treepoem
import treepoem
image = treepoem.generate_barcode(barcode_type='qrcode', data='Hello, world!')
image.save('qr.png')

Generates QR Code symbols in Python.

Downloads / mo
27.4K
Stars
6.8K
Last release
1.8.0
License
MIT

Quickstart

From qrcodegen.py
$ pip install qrcodegen
from qrcodegen import QrCode
qr = QrCode.encode_text('Hello, world!', QrCode.Ecc.MEDIUM)

qrcodegen examples

From open-source projects on GitHub

FAQ

qrcode suits applications that style QR modules and embed images through image factories. Segno suits code that needs Micro QR symbols or SVG, PNG, and PDF output without other dependencies. Treepoem suits systems that render QR codes alongside other barcode formats.

Segno is a pure Python QR Code and Micro QR Code generator with no dependencies. It writes SVG, PNG, PDF, and other formats through its own serializers.

qrcode builds a code through its QRCode class and encodes it as an SVG or PNG image. Segno writes the same kind of code to SVG, PNG, or PDF without image dependencies.

qrcode does not guarantee that styled codes work with all readers. Its documentation recommends testing them and setting error correction to high, especially when embedding an image.

Segno's default factory picks the smallest version that fits the content, including Micro QR versions. The make_qr function requires a standard QR code instead.

For coding agents

Found your QR code library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official