QR.js
Simple HTML5 Canvas-based QR Code generation
A lightweight, client-side JavaScript library that draws QR codes directly in the browser using Canvas, with no server or external API needed.
QR.js is a lightweight tool that generates QR codes—those square barcodes you scan with your phone—directly in a web browser. Instead of relying on an external service or complex library, it uses your browser's built-in Canvas feature to draw the QR code right there on the page. This means you can create scannable codes on the fly without sending data to a server.
The library works by taking any text string you give it and converting it into a visual QR code pattern. You can either draw it into an existing canvas element on your page, or have it create a new image that you can embed or download. You control how big the code is and how much error correction it includes—error correction lets the QR code still work even if part of it gets dirty, faded, or partially obscured. The README doesn't explain the underlying algorithm in detail, but it's based on established QR code encoding standards.
Typical use cases include: a developer building a contact-sharing feature for a website, a founder creating a simple tool to generate codes for product packaging without external API calls, or anyone who needs QR codes embedded in a web app without adding heavy dependencies. Since it's entirely client-side, there's no server cost or latency—the browser does all the work. The tradeoff is that it only works on modern browsers (IE9 and newer) because it depends on Canvas support, and it's fairly minimal compared to larger QR libraries. The project is small and focused—it doesn't try to do everything, just the core task of encoding text into a visual QR code format that standard scanners can read.
Where it fits
- Generate a scannable QR code in the browser for a contact-sharing feature without calling an external API
- Create QR codes for product packaging entirely client-side, avoiding server costs
- Embed lightweight QR code generation in a web app without adding a heavy dependency