A 5x5 pixel font for small screens
·2026.04.23 16:01
Key point
A 350-byte 5x5 fixed-width pixel font was designed to fit tiny OLEDs and 8-bit MCUs.
Details
A 5x5 fixed-width bitmap font was created to fit every character inside a 5-pixel square, allowing safe placement on a 6x6 grid.
It is based on lcamtuf's 5x6 font-inline.h, and is lineage-wise influenced by the ZX Spectrum 8x8 font.
Reasons for the choice
- 4x4 makes it hard to properly draw
E,M,W, and 2x2 is practically impossible. - At 5x5, most lowercase letters are drawn 1 pixel lower than uppercase letters to secure distinguishability.
- The narrower 4x5 and 3x5 are also possible, but sacrifice distinguishability between
M, dotted0, andU/V/Y. - Fixing the width lets string length be calculated as character count × 6.
Size and applications
- The whole font is 350 bytes, which fits well on 8-bit MCUs like the AVR128DA28; the text contrasts this chip's 16kB of RAM with the roughly 110,000 pixels of a 384x288 screen.
- Smaller screens like 160x128 or 128x64 OLED are more practical.
- Rendering of similarly sized vector fonts was also compared.
Experiments with even smaller resolutions
- 3x5: 27,904 out of 32,768 are distinguishable.
- 3x4: 3,392 out of 4,096 are distinguishable, but uppercase/lowercase distinction disappears.
- 3x3: 400 out of 512 are distinguishable.
- 2x3 / 3x2: 44 out of 64 are distinguishable, and 3x2 is more favorable for letters like
M,W,N,Q,G,P. - 2x2: in practice this is closer to a secret code than a font.
On actual screens, pixel spacing and subpixel effects affect the rendering results.