<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh" -->

---
title: QR Code Generators Suck. I Fixed Them. | daily.dev
description: A developer built a database-free link shortener and QR code generator called Hammer, explaining the encoding and compression techniques behind it. The project...
canonical: https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: QR Code Generators Suck. I Fixed Them. | daily.dev
og:description: A developer built a database-free link shortener and QR code generator called Hammer, explaining the encoding and compression techniques behind it. The project...
og:url: https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh
og:image: https://api.daily.dev/og/posts/tdzPjvHhH.png
og:image:alt: QR Code Generators Suck. I Fixed Them.
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# QR Code Generators Suck. I Fixed Them.

**[PortalRunner](https://daily.dev/sources/portalrunner)** · 22 min read · 1 upvotes · 0 comments

## Summary

A developer built a database-free link shortener and QR code generator called Hammer, explaining the encoding and compression techniques behind it. The project strips redundant URL parts (protocol, www, index.html), uses base-85 encoding instead of raw bytes, applies Huffman coding based on real-world character frequency data from Reddit link datasets, and generates QR codes using the proper alphanumeric mode instead of the wasteful byte mode most online tools default to. The video also covers a sponsor, boot.dev, and mentions a friend's transformer-model-based link compressor as a more aggressive alternative.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=TOr1Vvji6jA>

## Questions this post answers

### why do most online QR code generators produce denser QR codes than necessary

Most online QR code generators encode links using byte mode, a base-256 encoding, even though URLs only require a base-85 character set at most. This wastes space on every character. QR codes support an alphanumeric mode restricted to uppercase letters, numbers, and a few symbols, which is far more space-efficient, but most tools default to lowercase byte-mode links instead of using this mode.

_Anyone optimizing QR codes for production apps can find practical encoding breakdowns like this on daily.dev._

### how does Huffman coding compress text based on character frequency

Huffman coding assigns shorter bit sequences to more frequent characters and longer sequences to rarer ones, built by repeatedly pairing the two least likely symbols into a tree until only one group remains, then assigning 0 to left branches and 1 to right branches. It is fully optimal only when character probabilities are exact powers of two; otherwise arithmetic coding is more accurate but much harder to implement, with gains estimated at only about 15% over Huffman in the best case.

_Developers working through compression algorithms can track deeper explainers like this via daily.dev._

### why can't a link shortener avoid using a database entirely

There is a fundamental limit to how much a URL can be compressed, governed by information theory and entropy, so a database-free encoding scheme cannot guarantee consistently short outputs the way a database-backed shortener can. Techniques like bit-flags for protocol and www prefixes, base-85 payload encoding, and Huffman compression from real link datasets can shrink links somewhat, but a real database remains the correct approach for consistent short outputs.

_Weighing database-backed versus stateless designs for a shortener is easier with concrete trade-off breakdowns on daily.dev._

## Similar posts on daily.dev

- [Compress Links For Optimal QR Codes](https://daily.dev/posts/compress-links-for-optimal-qr-codes-bdwdbx3ya) · Hackaday · 1 upvotes · 0 comments
- [Guide to \(not\) fucking up QR codes](https://daily.dev/posts/guide-to-not-fucking-up-qr-codes-kukypm6ck) · Lobsters · 1 upvotes · 0 comments
- [Hand‑drawn QR codes](https://daily.dev/posts/hand-drawn-qr-codes-nygvh2gtx) · Hacker News · 3 upvotes · 0 comments
- [I built halftone photo QR codes in pure Dart \(no dependencies\)](https://daily.dev/posts/i-built-halftone-photo-qr-codes-in-pure-dart-no-dependencies--bhmzagq3s) · Medium · 0 upvotes · 0 comments

---

Tags: [#compression](https://daily.dev/tags/compression)

[View this post on daily.dev](https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"QR Code Generators Suck. I Fixed Them.","url":"https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh"},"datePublished":"2026-08-13T23:13:49.116Z","dateModified":"2026-09-14T09:20:10.560Z","description":"A developer built a database-free link shortener and QR code generator called Hammer, explaining the encoding and compression techniques behind it. The project...","image":"https://i.ytimg.com/vi/TOr1Vvji6jA/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/TOr1Vvji6jA/sddefault.jpg","isAccessibleForFree":true,"articleSection":"PortalRunner","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"PortalRunner","logo":"https://media.daily.dev/image/upload/s--aSL1WXXp--/f_auto/v1756381503/logos/portalrunner","url":"https://daily.dev/sources/portalrunner"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"compression","timeRequired":"PT22M","video":{"@type":"VideoObject","name":"QR Code Generators Suck. I Fixed Them.","description":"A developer built a database-free link shortener and QR code generator called Hammer, explaining the encoding and compression techniques behind it. The project...","thumbnailUrl":"https://i.ytimg.com/vi/TOr1Vvji6jA/sddefault.jpg","uploadDate":"2026-08-13T23:13:49.116Z","duration":"PT22M","url":"https://api.daily.dev/r/tdzPjvHhH","embedUrl":"https://www.youtube.com/embed/TOr1Vvji6jA"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PortalRunner","item":"https://daily.dev/sources/portalrunner"},{"@type":"ListItem","position":3,"name":"QR Code Generators Suck. I Fixed Them."}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/qr-code-generators-suck-i-fixed-them--tdzpjvhhh#faq","mainEntity":[{"@type":"Question","name":"why do most online QR code generators produce denser QR codes than necessary","acceptedAnswer":{"@type":"Answer","text":"Most online QR code generators encode links using byte mode, a base-256 encoding, even though URLs only require a base-85 character set at most. This wastes space on every character. QR codes support an alphanumeric mode restricted to uppercase letters, numbers, and a few symbols, which is far more space-efficient, but most tools default to lowercase byte-mode links instead of using this mode. Anyone optimizing QR codes for production apps can find practical encoding breakdowns like this on daily.dev."}},{"@type":"Question","name":"how does Huffman coding compress text based on character frequency","acceptedAnswer":{"@type":"Answer","text":"Huffman coding assigns shorter bit sequences to more frequent characters and longer sequences to rarer ones, built by repeatedly pairing the two least likely symbols into a tree until only one group remains, then assigning 0 to left branches and 1 to right branches. It is fully optimal only when character probabilities are exact powers of two; otherwise arithmetic coding is more accurate but much harder to implement, with gains estimated at only about 15% over Huffman in the best case. Developers working through compression algorithms can track deeper explainers like this via daily.dev."}},{"@type":"Question","name":"why can't a link shortener avoid using a database entirely","acceptedAnswer":{"@type":"Answer","text":"There is a fundamental limit to how much a URL can be compressed, governed by information theory and entropy, so a database-free encoding scheme cannot guarantee consistently short outputs the way a database-backed shortener can. Techniques like bit-flags for protocol and www prefixes, base-85 payload encoding, and Huffman compression from real link datasets can shrink links somewhat, but a real database remains the correct approach for consistent short outputs. Weighing database-backed versus stateless designs for a shortener is easier with concrete trade-off breakdowns on daily.dev."}}]}
```

