Programming Fonts

Computer programming requires a specialized form of reading. Programmers use a lot of different fonts for reading and writing code. In spite of this variety, monospace kerning and lightly styled san-serif typefaces are almost universally prefered.

Design Study:

In many ways typography is the soul of graphic design. A good font must find a balance between style and clarity given the constraints of display/printing technology. I recently had an opportunity to think about how typography is used in computer programming environments. When confronted with an open ended problem, I usually find a basic survey to be a helpful starting point. The results of this research are not shocking but, I think they are mildly interesting worth sharing.

The Data

The basic question of what fonts programmers use comes up every ~2 years on Hacker News [1], [2], [3], [4]. This offers a relatively rich dataset (n = 98) on people's actual practice. It is relatively easy to collect and tabulate this data to get a sense of what sort of fonts people use when writing code. Based on this analysis, what kind of typefaces do people use for reading and writing computer code?

Chart of font preference

As you can see there is a lot of variety when it comes to font preferences - allowing people to choose their own font is clearly a good idea for an IDE. There is probably some self-selection bias in this data. Default fonts like SF Mono are probably under represented here, however people who care enough to change the default settings are also generally a good group to listen to.

Moreover, while there is a lot of variety in the total number of fonts people use, a deeper look suggests that this diversity is largely superficial.


Chart of kerning preference

Monospaced fonts are used by 96% of respondents. This preference can be explained since kerning would throw off the layout and visual formatting of code.


Chart of serif preference

Similarly san-serif fonts are strongly prefered by 90% of respondents. This may have to do with the need to read very small letters. While serifs may have a slight advantage in reading speed, serifs can become blurry for very small glyphs.

Additionally, while there is a strong preference for san-serif fonts, this does not mean helvetica clones are always appropriate. Certain glyphs (i, j, m, n) are often used idiomatically in programming contexts.

Chart of serif preference for letter i

92% of the respondents used a font which had serifs on the lower case 'i'. The implication here is that a good programming font needs to provide additional styling on these characters.


Computer programming requires a lot of reading (sometimes >8 hours a day). While traditional prose writing is concerned with large tracts of text, computer code focuses more on punctuation and formatting. A single character can change the meaning of a line of code, and indentation reveals logical structure. Looking at the preferences of computer programmers, a good programming font should:

So what is a good programming font? Probably the top choice of this poll: Raph Levien's well constructed Inconsolata:

example of inconsolata

Data and scripts can be found here.