Hasty Briefsbeta

Text case changes the size of QR codes

21 days ago
  • #QR codes
  • #Python
  • #Bitcoin
  • Creating QR codes in Python using the qrcode library with mixed case and upper case sentences.
  • Mixed case sentences are encoded as binary data (ISO/IEC 8859-1), using 8 bits per character.
  • Upper case sentences are encoded as alphanumeric data, using 5.5 bits per character, reducing QR code size by about 30%.
  • Alphanumeric QR codes use a 44-character alphabet, allowing two characters to be encoded in 11 bits.
  • Example shows a reduction from a 33×33 grid (1089 pixels) to a 29×29 grid (841 pixels) when switching to upper case.
  • Application to Bitcoin addresses: Bech32 encoding (monocase) requires fewer QR code pixels than Base58 encoding despite needing 17% more characters.
  • Bech32 uses a lower case alphabet but converts to upper case before QR code generation.