11

Must-have

A few stipulations for an unambiguous font:
- It must be easily legible.
- It must have a slashed zero (so as to distinguish it from capital O). - It must sufficiently differentiate between the characters 1, l, |, and I.

Why? Because when people are writing code, or checking data and documents, they need to be able to distinguish easily between these characters.

Nice-to-have

Aesthetically pleasing

7
  • Perhaps this belongs on programmers.SE :-) Anyway, I too use Consolas. Oct 20, 2013 at 8:33
  • 1
    How does this relate to User Experience? Are you designing an application that has programmers as end users? Do you expect the end users to be incapable of selecting a font that suits them, then? Oct 20, 2013 at 12:06
  • 2
    Duplicate of: stackoverflow.com/questions/4689/… Oct 20, 2013 at 17:35
  • 1
    Putting this on hold. It was probably closed off on StackOverflow because it's not a question with a correct answer. Also, as @DannyVarod points out it already has a closed duplicate on StackOverflow, and with 100+ answers it demonstrates why such questions don't really work in this format, but should also give you plenty of useful suggestions.
    – JonW
    Oct 20, 2013 at 19:20
  • "If you throw a list of fonts at me" = likely why it's been closed everywhere you post it.
    – DA01
    Oct 20, 2013 at 23:51

2 Answers 2

19

Monospaced fonts can provide what you're looking for, a good example of which is Consolas.

Consolas is the standard font on Visual Studio 2010 and 2012, and Eclipse Indigo (the standard font on previous versions of both these tools being Courier New 10).

Consolas Preview

Consolas has been described (here) as "...a sans-serif font with the same rounded appeal [as Lucida Console], but nevertheless retains the traditional "code" feel, with monospaced characters and a "boxy" look."

It holds all the characteristics of a programming font; namely being sans-serif, fixed-width, slashed zero, and sufficient differentiation between the characters 1, l, |, and I.

Consolas -- differentiation between similar characters

Consolas is clear, concise, and (for the same font-size) takes up less room than Courier New.

Its only short-coming, however, is that it was built specifically for ClearType, and is a commercial font. It ships with all major new Microsoft releases though, and is therefore most suited for programming on newer Windows machines (you can get it for Mac if you install Microsoft Office). As an alternative to Consolas on Mac or Linux, you could try Monaco, Ubuntu Mono, DejaVu Sans Mono or Anonymous Pro.

If you'd like more options, check these articles:
Hivelogic - Top 10 Programming Fonts
Slant - What are the best programming fonts

UPDATE:
Here's a graphical comparison of Consolas against the other fonts mentioned in this answer:

Monospaced Typefaces comparison

For a full list of the comparison, see Samples of monospaced typefaces and some more here - 42 of the Best Monospaced Programming Fonts, courtesy of comment from @Basil Bourque.

5
  • 1
    I do use DejaVu Sans Mono on Windows. Why not? Oct 20, 2013 at 13:28
  • There is also a CSS enhancement that tweaks fonts that don't distinguish zero from O very effectively: thenewcode.com/656/… Dec 7, 2015 at 11:15
  • @YvonneAburrow: Interesting, thanks! That would be Plan B if one is keen on using a font that doesn't do it natively. Browser-specific issues might arise though.
    – SNag
    Dec 7, 2015 at 12:52
  • 1
    Here is a fun bit of valid javascript valid that returns true... Il1I=007 ; (0O07|0O10) === (0o10|Il1I). Ill be using a serif font like Dejavu serif, takes less space and gets the job done.
    – Ray Foss
    May 1, 2021 at 1:59
  • @RayFoss an elaborate way to demonstrate that bitwise OR is commutative, but it is also entertaining and it demonstrates the point that readability can be important and fonts contribute to that. May 9, 2023 at 16:26
0

I like your opening gambit! :)

For me I like courier new in Sublime; but that doesn't answer your question. It also doesn't help that the default Windows font viewer uses the string 1-9 to display.

SNag's answer has everything down to a tee - especially when it comes to i, l and 1.

For a list of zero slash fonts look here

Knock yourself out.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.