Skip to content

Comment on Client-side QR code generator with SVG output

Comments

If you stumbled upon this looking for the smallest QR code JS library, it's probably LeanQR [0]. It's under 10kb minified and 5kb compressed.

[0] https://qr.davidje13.com/

While I didn't never specifically optimize it for the size (unlike some libraries I do), my very old qr.js library [1] seems to be smaller than that, less than 9 KB minified and 4 KB gzipped in my brief testing.

I should note that qr.js never supported the correct Kanji encoding and optimal encoding based on dynamic programming, but otherwise it is functionally complete and I think it can't get much larger than that. There are lots of rooms to cut from there and I will say 5 KB is a fair estimate for the minified size after modest but correctly guided size optimization.

[1] https://github.com/lifthrasiir/qr.js (predates the modern JS, but surely more popular than LeanQR I believe)

Huh. Didn't run in to it when I was searching for libraries. It appears to be just 350 bytes larger than LeanQR when gzipped.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.