https://www.johndcook.com/blog/2025/10/31/smaller-qr-codes/ John D. Cook Skip to content * MATH + PROBABILITY + SIGNAL PROCESSING + NUMERICAL COMPUTING + SEE ALL ... * STATS + EXPERT TESTIMONY + WEB ANALYTICS + FORECASTING + RNG TESTING + SEE ALL ... * PRIVACY + HIPAA + SAFE HARBOR + CRYPTOGRAPHY + DIFFERENTIAL PRIVACY + PRIVACY FAQ * WRITING + BLOG + RSS FEED + TWITTER + SUBSTACK + ARTICLES + TECH NOTES * ABOUT + CLIENTS + ENDORSEMENTS + TEAM + SERVICES (832) 422-8646 Contact Text case changes the size of QR codes Posted on 31 October 2025 by John Let's make a QR code out of a sentence two ways: mixed case and upper case. We'll use Python with the qrcode library. >>> import qrcode >>> s = "The quick brown fox jumps over the lazy dog." >>> qrcode.make(s).save("mixed.png") >>> qrcode.make(s.upper()).save("upper.png") Here are the mixed case and upper case QR codes. [qr_mixed_upper] The QR code creation algorithm interprets the mixed case sentence as binary data but it interprets the upper case sentence as alphanumeric data. Alphanumeric data, in the context of QR codes, comes from the following alphabet of 45 characters: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./: Since 452 = 2025 < 2048 = 2^11 two alphanumeric characters can be encoded in 11 bits. If text contains a single character outside this alphabet, such as a lower case letter, then the text is encoded as ISO/IEC 8859-1 using 8 bits per character. Switching from mixed-case text to upper case text reduces the bits per character from 8 to 5.5, and so we should expect the resulting QR code to require about 30% fewer pixels. In the example above we go from a 33 x 33 grid down to a 29 x 29 grid, from 1089 pixels to 841. Application to Bitcoin addressess Bech32 encoding uses an alphabet of 32 characters while Base58 encoding uses an alphabet of 58 characters, and so the former needs about 17% more characters to represent the same data. But Bech32 uses a monocase alphabet, and base 58 does not, and so Bech32 encoding requires fewer QR code pixels to represent the same data as Base58 encoding. (Bech32 encoding uses a lower case alphabet, but the letters are converted to upper case before creating QR codes.) Related posts * Base 32 and Base 64 encoding * Two meanings of QR code * Dithered QR codes Categories : Math Tags : Coding theory Cryptocurrency Bookmark the permalink Post navigation Previous PostAn ancient generalization of the Pythagorean theorem Next PostCross ratio Leave a Reply Your email address will not be published. Required fields are marked * [ ] [ ] [ ] [ ] [ ] [ ] [ ] Comment * [ ] Name * [ ] Email * [ ] Website [ ] [Post Comment] [ ] [ ] [ ] [ ] [ ] [ ] [ ] D[ ] Search for: [ ] [Search] John D. Cook John D. Cook, PhD My colleagues and I have decades of consulting experience helping companies solve complex problems involving data privacy, applied math , and statistics. Let's talk. We look forward to exploring the opportunity to help your company too. John D. Cook (c) All rights reserved. Search for: [ ] [Search] (832) 422-8646 EMAIL