This page gives information on selecting fonts useful as coding fonts, e.g. source code in programming languages or web design languages.
A good coding font is absolutely critical for good coding productivity. There are several desiderata for choosing a coding font:
- Font Type: usually the coding font must be a monospace font.
- Character Set: the font should have all characters needed by the language. For most languages, e.g.
C or CSS, this is easy: these languages use only ASCII characters, which are supported by nearly all fonts. But some languages, such as HTML, can use
many more characters, e.g. unicode characters, or windows-1252 accented characters, which many fonts don’t support.
- Distinct Glyphs: the font should have clearly distinct glyphs, e.g.: clearly dissimilar glyphs for similar characters like O
and 0, or like l,1,
and I.
- Extra Large Punctuation: the font should have punctuation marks that are extra-large,
e.g. so that . is clearly distinct from ,
and : is clearly distinct from ;.
- Legibility: the font should have clearly legible glyphs, e.g. characters should not be pale or tiny.
Character size is a special concern: characters should be 1 small enough that as much code as possible is visible
at one time, but 2 large enough that the code is easy to read. This is a special concern for
people who suffer from vision problems like hyperopia.
- Ligatures: the font should have ligatures for operators
— e.g. == for ==,
or != for != —
iff the coder wants them and their text editor supports them.
NB: you will have seen differences in
== and != in the preceding sentence
iff your PC has a font named in this page’s font stack.
NB: fonts which support ligatures may not support every ligature you want; you must check.
I now use Input Mono as my coding font:
it has a rich character set, distinct glyphs, extra-large punctuation, and is quite legible
— though it has no ligatures, a feature I want only for pseudo-code. Before using the Input Mono font I used
DejaVu Sans Mono,
then Cascadia Code,
then IBM Plex Mono,
each a bit better for my purposes than the one before.
