Many articles and websites compare fonts for programming — all are excellent resources. So why am I raising this topic again? Because I always lost myself in dozens of fonts and could not figure out which one is better. So I tried a lot of fonts and chose the following for you. They are quite popular and easy to get. And most importantly, all these fonts are free!
I ranked the fonts by the following indicators:
- How distinguishable are similar symbols, such as
0O
, 1lI
. - Is the font easy to read (width of lines, width / height of characters).
- And my personal preference!
All screenshots are made in VSCode on one piece of code. Unless otherwise indicated, the size is set to
"editor.fontSize": 14
.
1. Hack
Hack is a free font, specially designed for source code and based on Bitstream Vera and DejaVu projects.
0O
and
1lI
clearly distinguishable, and the font as a whole is easy to read. I especially liked the zero with a vertical slot.
')

2. DejaVu Sans Mono
Derived font from Bitstream Vera. This is also a good option with a free license. Sans Mono clearly distinguishes between
0O
and
1lI
. The dot inside
0
not as noticeable as that of Hack, but overall the font is comfortable.

3. Monaco
Monaco was used by default on OSX until Snow Leopard was released. The characters are well distinguished, therefore it is difficult to confuse
0O
and
1lI
. I like this font because of its special style, as if going back to OSX (now I mostly use Ubuntu).

4. Source Code Pro
Source Code Pro is developed by Adobe. In general, the text looks clearer than other fonts, not to mention the good distinguishability of characters.

5. Menlo
Menlo is the new default font for macOS for Xcode and Terminal. This is a derivative of DejaVu Sans Mono. Personally, I prefer Monaco, since I have been using OSX for a long time, but Menlo is also a good choice for programming.
Addition: Menlo is no longer the default font in macOS. In the High Sierra version, the default font was changed to San Francisco Mono, which is also an excellent choice for programming. Thanks to
Ivan Kantarino and
p13t3rm .
6. Consolas
Consolas is the default font in Visual Studio. It is very popular because it comes with Windows. Personally, I don’t really like the
l
character, because it is easily confused with
1
.

7. Space Mono
Space Mono is designed by Colophon Foundry and is an excellent monospaced font. I note two shortcomings: 1)
l
can be confused with
1
; 2)
,
no different from
.
on the font size of 14 points.

8. FiraCode
FiraCode supports ligatures, that is, it can combine two or more characters into one character to make the code easier to read. Pay attention to
!=
,
<=
, And
==
in the screenshot. Personally, I got used to the original characters, and ligatures confuse me a little. But someone may like this font.

Note: to activate ligatures in VSCode, add the following line.
"editor.fontLigatures": true,
9. Anonymous Pro
I like
Anonymous Pro because it gives the feel of a typewriter. In addition,
<
is narrower here than in Hack, so it looks more like a sign.

10. IBM 3270
The IBM 3270 is based on the font used in the IBM 3270 console, released by IBM in 1971. This font is great for programming and is made in the style of retro (although it is not quite familiar to me).

Please note that this font is relatively small, so I propose to increase the font size and reduce the line height to make it more readable on the screen.
"editor.lineHeight": 20, "editor.fontSize": 14,
11. Droid Sans Mono
Droid Sans is made for Android and is very beautiful. But the biggest problem is that it does not have a zero with a slit, so
0
and
O
not distinguishable.
Addition: For Droid Sans Mono,
options are created where there is a zero with a strikethrough and a dot. Thanks
hawtre smith .
Thank you for reading! Hope this article helps you find a new font for an IDE or console! Please recommend this article to others if you like it!
ADDITION:I received feedback about other fonts for programming. Yes, they are all wonderful, totally agree! The main purpose of this article is to provide an initial base for those who have little experience with a variety of fonts, so I will try to keep the minimum list and not overload people. But thanks everyone for the feedback. I am pleased to try in the daily work of the font that you mentioned.