Fonts for Writing Code

Mono-spaced for fixed-width fonts are preferred for writing code because they better differentiate between certain characters (such as upper-case I and lower-case l) and they also give more space to important characters like the exclamation point, semi-colon, brackets/braces, etc. Reading these different kinds of characters is harder when using a variable-width or proportional font, and can therefore cause errors and problems in your code.


two examples: Ubunto Mono and Fira Code, both examples show the characters l 1 I and O 0
Examples of some commonly-confused characters using Ubunto Mono and Fira Code. You can clearly see the different between the l, 1, and I and the O and 0.

the same characters l 1 I and O 0 using Arial: the l and the I look exactly the same, and the O and 0 look very similar, one is a bit skinnier
Example using Arial: you can't tell the difference between some of the characters.

Using mono-spaced fonts also makes it easier for characters to line up. For example, when you indent your code using tabs or create some output in rows and columns, it's easier for things to align with a fixed-width font. This is because proportional fonts' characters are all different widths, but in a fixed-width font, all characters are exactly the same width.


bits of code and text output nicely aligned using Unbuntu Mono, including a list of dollar amounts that are perfectly aligned at the decimal point
Some sample code/output using the fixed-width font Ubuntu Mono

bits of code and text output that aren't aligned nicely: the list of dollar amounts are not lined up at the decimal point and look messy and unprofessional
Some sample code/output using the variable-width font Arial

Recommended Mono-Spaced Fonts

Which mono-spaced font should you choose? Most editors use Courier New or Lucida Console, but those aren't the best at differentiating between certain characters. A long time ago, I found the Ubuntu Mono font, and a couple of years ago a student showed me the Fira Code font (Fira Code already comes with the IntelliJ IDE). I like these 2 fonts because it makes those confusing characters appear completely different.

Getting and installing these fonts is super easy. Here are the zip files for both fonts (you only need one, but you might want to download both and choose the one you like best):

  • Ubuntu Font (you only need to install the Ubuntu Mono versions, but feel free to install them all, it's much easier: just click the "Download Family" button in the top-right)
  • Fira Code (already comes with IntelliJ, so if you installed IntelliJ you probably don't need to download/install Fira Code)

Install the Font

Now that you have a font downloaded, you can install it to Windows and then configure your IDE/Editor to use that font.

Add The Font to Windows

First, you have to install the font so that Windows includes it in the list of available fonts when it runs applications. Installing a font is really easy! Unzip the zip file to its own directory (your zip utility should have a quick option for this: with mine I just right-click the zip file and select "extract to /zipFileName" to extract all the files inside the zip to a new directory that has the same name as the zip file).

Once you've unzipped the file, select the fonts you want to install (you can Ctrl- or Shift-click like you do with any set of files) and then right-click > Install. That's it!

If you're unable to install that way, just double-click a font file, then click the "Install" button in the dialog box. Do this for each font file.

Changing your IDE/Editor's Font

Now you can tell your IDE or Editor to use your new monospace font: If your editor is running, restart it and then go to your settings and change your font.

Notepad++ instructions:

  1. In the menu, choose Settings > Style Configurator.
  2. On the left side of the dialog, make sure that Global Styles is selected in the "Languages" list and Global Override is selected in the "Styles" list.
  3. On the right side of the dialog, under "Font Style", select the Font Name as either "Ubuntu Mono" or "Fira Code" (if Fira Code is a bit too light, try "Fira Code Medium").
  4. On the right side, check the boxes for "Enable Global Font" and "Enable Global Font Size"
  5. Click the "Save & Close" button to save your changes.

IntelliJ instructions:

Fira Code should already be available if you installed IntelliJ. If you want to use Ubuntu Mono, install it first and then restart IntelliJ. To change your font, do the following:

  1. In IntelliJ IDEA, go to the "File" menu and choose "Settings".
  2. In the Settings dialog, on the left side, open the "Editor" option and select "Font".
  3. In the main part of the screen, you can use the Font: drop-down list to choose the Fira Code font.

Other Editors/IDEs:

The instructions above will likely work in a similar manner with any other editor or IDE. Shut down your editor/IDE and then install the fonts. Restart your editor and use the preferences/settings to change the fonts.