249 comments

[ 3.2 ms ] story [ 277 ms ] thread
There should be more variable-width coding fonts.
As someone who's never used a variable width font for writing code, I have to ask why would you want that?
The kerning is easier in your eyes, and is also much more space efficient. The only drawback is the inability to do ascii art.
And aligning text in some indentation styles
Maybe it's because I've only used fixed-width fonts for programming and have gotten used to it - but I find fixed-width fonts significantly easier on the eyes.
Only when coding or always, for example books and websites including this one?
Only when coding or working with raw text, I use variable-width fonts everywhere else (reading, browsing the web, etc).
But would you ever read a novel using fixed width fonts? Modern typography uses variable width fonts for good reasons.

I find type writer fonts to look horrible since I’ve gotten used to variable width fonts. It’s like immediate eye strain for me. But you have to choose a good font, times new Roman won’t work.

I used DejaVu Mono Book for quite a while, I had no problems with it.
While I wouldn't say it's THAT significant, there is one other advantage to fixed-width fonts that I've experienced. Due to the fact that they align vertically, sometimes they expose mistakes if you're constructing data in a table-like fashion. Or when you have a bunch of copy/pasted lines that differ only in the parameter values. Like, "Hey wait a minute... this line is 1 char wider than the previous one. Oh, whoops, I fat-fingered something there".

I wish I had more specific examples and could quantify it better, but I know I've caught quite a few errors this way.

This exactly. Most recently I had a script that was calling functions with fixed width data sets (IDs, credit card numbers, birthdates, etc..), and typos were significantly easier to find due to the data and fonts both being fixed width.
This is because we don’t have any decent rich formatting options available for code in a plain text file. You could totally find those errors in an excel spreadsheet, and excel doesn’t default to using fixed-width typewriter fonts.
Variable width fonts are generally more readable, which is why they’re generally used for prose.

Fixed-width fonts allow for easy tabular rendering in a text editor. Some programming styles use this heavily but it’s not universal. Particularly, if you rely on line-by-line blame in source control, alignment changes can make it harder to find the commit where the most recent semantic change happened.

Traditional fonts even had non-lining figures, with varying heights for easier readability. Modern-style figures were only really used for tabular display, or with content written in uppercase/title-case. (Of course, it's hard to support this kind of complex text styling when editing plain-text files that are going to be fed to a compiler, or some other text-processing step.)
But source code is very different from prose. Are there any studies on fixed-width vs. proportional readability specifically when it comes to programming?
I use Geneva for coding. Variable width typefaces are easier on my eyes. I find that my page-scanning more readily gets lulled into laziness when using fixed width. And variable width keeps me from doing goofy alignment games with blocks of similar text (e.g. lining up the `=` signs in a list of assignment operations) that I invariably regret later.
Stroustrup uses them in The C++ Programming Language and it is made it much nicer to read.

If you're using tabs for indentation, and not trying to do pointless alignment then there's really no reason to use monospaced fonts at all - it just makes things uglier.

I use visual block mode editing quite a lot. I can't imagine that works well with a variable-width font.
The latest release of Iosevka has a "quasi-proportional" variant called Iosevka Aile which I really, really like.

Here's a 3200x1800 screenshot with some code in Emacs.

https://i.imgur.com/LdzBmpx.png

The kerning is not as tight as in a real proportional font. It's a bit more spacious and regular so that fixed width tabular layouts still look relatively decent.

The original image might’ve been 3200x1800 but it sure ain’t on imgur, unless I’m missing an obvious ‘view raw/original image’ option...
Uhhh sorry I don’t understand imgur. I think there’s a way.

Oh it seems that the mobile imgur site is totally nerfed. Sorry. Is there a better free image host?

Ah, no worries - I’ll take a look on desktop in a minute. Better free image host? I guess github pages is a less-friendly alternative.
Right-click the image, and choose "View image". Works at least in Firefox.
I should’ve mentioned I’m using a tablet. Although there’s a convoluted method involving long-hold and the Photos app, it still only save the low-res thumbnail.
Maybe try copy&pasting the URL instead of clicking it (so that no Referer is sent)?
Well, I'm not sure if there's a way of doing that on iOS, but I'm on desktop now anyway, so if anyone else just wants a direct link to the full-size image, here it is:

https://i.imgur.com/LdzBmpx.png

(edit: although, nope, even opening the direct URL to the image reroutes it to the low-res thumbnail version. I just don't think it's viewable on mobile — never mind!)

Incredibly readable, thanks for sharing. I like your color scheme, too.
It's an Emacs theme called "cyberpunk". :D
I can't seem to find even one variable-width font with programming ligatures.
Nice article.

I think most just stick with fonts they've used in the past. In my case, I can't get myself to use anything other than Apple's Terminal (which uses SF Mono). Maybe later in the future I may budge and move off of it (iTerm2 for some reason can't quite exactly get SF Mono right, even though I import it).

What about it is wrong? Apart from a different weight (which you can disable if you’d like) I’ve found SF Mono to work quite well in iTerm.
My current favorite is the 8x16 Atari ST system font. Its thick strokes really help my aging eyes. Bitmap fonts for life.
I also love bitmap fonts, but when you're switching screen sizes it's annoying to have to change your config each time.
That's when you cheat and use a TrueType version of the bitmap font :)
But then it's not as crisp looking :(
I see Input Mono is mentioned, but I actually really like using Input Sans, also from Font Bureau. It's a proportional coding font. I feel like I'm living in the future.

You can get it here: https://input.fontbureau.com

And amazingly, you can personalize your font on download, such as choosing dotted vs slashed zeroes.

Not free, but free for personal, non-commercial use. (Check the terms)

I've been using proportional fonts for coding for years. Nobody notices when looking at my screen or when doing a screen sharing session. The few times I talk about it everybody agrees that it's easier to read. I'm not surprised, because nobody formats books, magazines, newspapers, web sites with monospaced fonts. The only problem is that it's impossible to align code on successive lines to the right of an equal sign. Not a big deal. It's also pretty impossible to write ASCII diagrams in comments. AFAIK there is no editor that can help with that, unless one wants to code inside a word processor.

I'll try Input Sans.

ASCII diagrams in comments/docstrings are doable if your editor supports custom faces. For example `M-x list-faces-display` on emacs tells me that (among other things) I can customize:

- font-lock-comment-face - font-lock-doc-face - org-table (also depends on alignment)

Web pages and books almost always format code with fixed-width fonts.
There’s now also Output[1], designed for UI rather than code, but with a feel that is very similar to Input.

1: https://djr.com/output/

For ~6 months I used Comic Sans as my single font system-wide - like, for everything. Everywhere in the system UI, code, even on webpages (Firefox lets you disable CSS font selectors). The only exception was the terminal, which got messed up with non-monospaced fonts.

It was actually surprisingly great. Then as soon as I got a 4k monitor Comic Sans started to look very ugly - if not for that, I would still be using it. These days I use GNU FreeFont (FreeSans) for the system & Firefox & IDEs, but I have started to do almost all programming through the terminal so I use Fira Code and [Liga]Hack for that.

So give Comic Sans a shot, you might end up liking it too :) (On Windows/macOS you probably won't be able to set it as your system font, but you could still use it in your IDE and on the web)

I have to ask, why Comic Sans specifically? Seeing as it almost universally regarded as an specially ugly font. The only uses that I’ve seen accepted for Comic Sans are for use in comics (obviously) and for people with dyslexia.
I use Comic Sans as my font for closed captions. I'm not dyslexic, but I actually find it way easier and quicker to read than something like Helvetica. But I would never ever use it in a design.
I saw a Reddit post saying the same thing as my post here (CS is nice, try it out). I did and I just liked it. It's not ugly.
Input looks good I'm going to check that out. I've been using https://sourcefoundry.org/hack/ for a while. I couldn't find anything better at the time for 10pt terminals.
How does column select mode work with a proportional font? Is it ever an issue?
Those braces are quite wiggly
This is missing Terminus[1], a wonderful bitmap font which is widely available on unices.

[1]: https://sourceforge.net/projects/terminus-font/

Terminus is pretty well known, though.
I really like Terminus and have been using it for years. My problem with it is the width -- it's just takes so much space that I can't read nicely 2 files side-by-side. Does anyone know similar font just bit narrower? Fonts that have been designed with anti-aliasing in mind fall out immediately.
Give me Consolas or give me death.

I have tried many programming fonts. I love articles like this that expose to me to new, fun things to try. But alas Consolas is King.

I used to think this, until I went on my quest to find a better fonts. Microsoft did a really good job on Consolas to make it look great on Windows.

Unfortunately a lot of coding fonts dont hint well on Windows, or only look good in hiDPI...

Eventually I settled on Droid Sans Mono, which I modified to have a slashed Zero.

Yup. These days a shocking number of people never test on Windows or a 1080p monitor.

Windows is my primary dev environment. I don’t think many people are even trying to look good there. So I’m not sure Consolas will ever be dethroned. Not for me at least.

I also use Consolas, but from time to time I have to read code on another machine or some environment without Consolas or rendering problems, and the things is: if the other font is good at first it's a bit hard, but after a couple of minutes I don't feel like it's a problem reading it. Then going back to Consolas I have almost the same experience. So my anecdotal, personal idea about this is: as long as the font doesn't suck, it just doesn't matter. Same with books: I read everyday, different fonts, not once did I think 'wow this font should be banished, it hurts my eyes' or 'wow every book should use this font'. Of course on a subconcious level there might be fonts which measurably perform better (i.e. need less cognitive processing by the brain) so: show me the evidence before claiming your font is much better than mine :)
I know it's mentioned in the article, but I've loved using Fira Code for awhile. It's made some parts of code much easier to read in ruby and javascript.
My favorite coding font is Monaco. Feels like the cleanest of them.
Monaco 9 in BBEdit :)

"Monoid" in the linked article made me think of it immediately.

Exactly what I was thinking - most of my earliest coding experiences involved editing 9-pt Monaco in BBEdit!! heheh :)
I can agree with this. It's especially wonderful without aliasing on an even multiple Retina display. For example, 2x on a 5k Monitor (iMac, LG Ultrafine) or MacBook Pro. It's simple, clean, tried and true.
Monaco 12pt has been my font for the past decade
Tweaking the coding fonts is the ultimate form of productivity porn. Don't do that unless you see any actual problems with your current font.
I think switching up how you do things from time to time keeps things fresh. Change your wallpaper! Rearrange your office! Go without syntax highlighting for a day! And, yeah, change your programming font.
I would check out nerdfonts[1] it includes some of the ones listed in inside it

[1] https://www.nerdfonts.com/

What is the use case for all of the extra icons? Not criticizing, I'm just wondering if there's something that I missed.
Of all things in the world to say, congratulations to Microsoft for their work on Cascadia Code: https://github.com/microsoft/cascadia-code

It's hard to do these fonts justice via preview alone, but in whole it's very legible to read.

Aside: If you want fast access to a ton of fixed-width (coding) fonts, pre-patched for powerline, you can grab them at https://github.com/powerline/fonts.

If you do CJK (Chinese, Japanese, Korean) characters in the terminal and want crisp, bitmap ligatures, I recommend Wen Quan Yi Micro Hei. But it doesn't work well scaled up in HiDPI monitors unfortunately! CJK in the terminal is still kind of a mystery to me.

I don't like the Cascadia Code font! It feels difficult to read, full of fluffs and blings.

Cascadia Code looks like the Comic Sans of programming fonts.

When I was researching coding fonts for myself I've found the two I liked the most were Iosevka and Fira Code because of their ligature support (DejaVu Sans Mono is also good but typically doesn't have ligatures). The choice between them comes down to whether you value having more horizontal space (shorter lines) or vertical space. Iosevka is horizontally compressed, meaning you can fit more characters into a given window width, and Fira Code is more vertically compressed.

Also, in Visual Studio Code you can fine-tune your coding font using these options:

    "editor.fontFamily": "'Fira Code', monospace",
    "editor.fontSize": 14,
    "editor.lineHeight": 14,
    "editor.letterSpacing": -1.0,
    "editor.fontWeight": "300",
    "editor.fontLigatures": true,
I recommend tuning your lineHeight and letterSpacing.
I really want to use Fira Mono/Code, but it sadly doesn't support italics, which is a deal-breaker for me, so instead I've been using Iosevka for a week. It's really pretty!
I'm a big fan of https://github.com/belluzj/fantasque-sans/ the characters make me happy every day :)
i used it for long time, got exposed to go-mono from this list, serif for code, giving it a try
Huge fan of Go Mono. I was taken aback at first at the idea of a monospace serifed font, but after trying it out I've come around to appreciate the clarity of it.
I'm tempted to switch to it, since it's remarkably similar to the Gallant font (a.k.a. sun12x22 / gallant12x22) I use on my OpenBSD and Linux virtual consoles. I tried using Gallant directly, but apparently Linux console fonts don't map cleanly to X11 bitmap fonts and it caused issues that I didn't feel like troubleshooting.
Every thread about programming fonts is not complete without mentioning the wonderful website https://app.programmingfonts.org (no affiliation, I just find it really useful) which lists all the free programming-related fonts with live preview (for example every single font from the article, and every one mentioned so far in every comment in this thread is already there in the app) - it allows quick one-click preview with custom text on each font, and has direct links for downloading said fonts.

Every font from this thread is already there in the app so you might as well just try them all.

Thank you!!!! I've been looking for something like this for some time now.
All free fonts I think? It doesn’t list for example Dank or Operator.
That's probably the case, thank you, I should have mentioned that.
Indeed, just the free ones. Although perhaps I should list the commercial ones too in some way. That said, I do tend to feature them in the tumblr blog, so you can search that for a preview, background info and a link.
That is a truly fantastic site but it doesn't mention https://dank.sh/ which I first heard about in this thread.

Just to nitpick.

But I am right now going through every one of those fonts in the app to compare with the one I've used for almost a decade now.

Do you like it?

One of the things that really gets in the way of comprehension for me are typefaces with too much personality. These cutesy italics etc. really seem to affect my ability to get on with the job at hand.

This is why, despite trying, I've yet to find something that can outdo Consolas on Windows. I tried Fira this and that, Source code pro and a bunch of others from Google Fonts. They all are inferior to Consolas in my eyes. They'll either be missing the slotted '0', or look crowded in small sizes etc.

Do I like Dank Mono? I am indifferent to it. It hasn't sold me on switching from Source Code Pro.

It's better than a lot of other fonts I've seen on programmingfonts.org so far. But just because a font is good or on par with my current one doesn't mean I'll use it. Force of habit is a big factor.

The guy from PracticalTypography also recommends Source Code Pro as his free monospaced font of choice.
Microsoft has another font called Cascadia which I think is their attempt to improve Fira Code.
I've moved to it recently and is my new favorite. Mainly because my eyes are getting old so I don't need it to look good at 7 pt since I couldn't see it anyway. And I like thicker fonts like this.

My one complaint is the tilde.

Have you tried Ubuntu Mono? It's not as thick but is quite readable. Also their bold variant might satisfy you if the regular doesn't. DejaVu Mono is also quite adequate.
I found it terrible, not only because of the surplus personality, but due to aesthetic and readability issues.

Readability - the r looks to me closer to an i, not the i of this font but a generic i, I find it confusing and it slows me down.

Aesthetically - the f character have space before it that in many combinations cuts a word to two, for example in the word delightful. Generally the font is mono-spaced, but the space between and after characters varies a lot.

I found it terribly incomplete. $40 and it can’t cover all four standard weights: regular, bold, italic, and bold italic. I believe it was last one, bold italic, that it was missing and the website is careful to obscure that fact.
And the ridiculous of those italics glyphs. Like, who decided that the f and l should have huge decorative slings but not the g?
Ubuntu Mono is the only one that rivals Consolas, imho. I used Monaco for the longest time but keep coming back to one of these two
I use Monaco for coding and Ubuntu Mono for my terminals, for years. Best combo so far although Agave does look nice.
Too much of the cursive can damage readability, but if it's constrained, then it actually helps a lot. I use Dank Mono and write primarily in JS. I use the cursive for things like `let` and `const`, which helps them stand out. It's a very nice typeface, well worth the money.
I truely wonder how many people purchased a font for coding, at $40 when so many perfectly suitable fonts are free/open source.
Not to sound flippant or pretentious, but for me, $40 is practically free for a software tool. On top of that, I can expense licenses if I use them for my work. I’m guessing that most people in my position would have no problem paying $40 for a font.
It's still a bit much IMO. It reminds me of Sublime Text being priced at $70 or Input Mono being $40-100+ depending on the options you choose.

I assume they are willing to accept the risk of piracy and/or lost sales to free alternatives like Fira Code, and plan to make their money on institutional licenses instead.

I would bet that most who wouldn’t buy Sublime at $70 wouldn’t buy it at $35 either. If you’re paying for text editors and fonts they’re probably important enough to you that you probably won’t let price deter you unless it’s truly exorbitant.

Personally speaking I’m a bit more spendy on small dev products because I know it’s harder for them to stay afloat, unlike Jetbrains or Adobe which aren’t really impacted by my purchase decisions in any meaningful way.

I am not saying you are wrong but to me the real problem is death of a thousand cuts problem: I have zero issues paying for quality work and I do; but when these things start piling up -- fonts, images, logos/icons, IDEs, creative software -- you can easily find yourself spending $1000.

I am not stingy but I feel drowned in a sea of good work each requiring its payment. This phenomena turned me off paying for fonts and settling for free ones.

(comment deleted)
Is there a side-by-side comparison between this and Fira Code? They look very similar (apart from the italics).
Thanks for the introduction to Dank. First time I've seen it and I like the look of it. Particularly the 'f' shape.

What's the closest free font you've seen to it? As it's so different from my usual monospace font I want to try ssomething similar first to see how I find it, before spending money on it.

I find Dank's "f" disturbingly idiosyncratic.
I am genuinely interested in knowing the appeal programmers find in fonts.
Im not sure I follow. Are you saying you don't understand why people who stare at letters on a screen all day every day for a living might have an interest in the fonts used on said screen?
A good programming font helps avoid confusion. For example, it should be clear if a character is l, I, or 1 without having to see them next to each other (also o, O and 0 as well as others). A font should also make reading code as pleasant as possible (though of course this is highly subjective).

When you consider that programmers spend most of their time reading code, it's not surprising that many programmers care about the font being used.

We stare at text for hours on end, every day. We want the text to be functional... and pleasant to look at. I change fonts frequently, just to spice up my life - it's a little like changing your desktop background on a regular basis.
Well, we spend almost all of our time reading code. I think it only makes sense we develop strong opinions about the font we do that in. It's an essential part of the interface.
Practically, we look at text all day long, so having a font that is easy to read is good ergonomics. A font may be good for code, but might not work as well in a tool like htop or gotop.

Monospaced fonts are also interesting from an artistic perspective that resonates with programmers. Font designers are able to be expressive and original despite — or perhaps because of — the constraints of the problem: all characters must have the same width and the text should be readable for long periods of time, often at small sizes.

what I don't like about thus site is that there are no large bitmap fonts (not even the x11 standard bitmaps, which are great)
What bitmap fonts do you miss? The site is currently restricted to fonts with a license that allow me to serve a web font for the live preview. So while there are a bunch of bitmap fonts in there, there might be some missing. I love to find out about new fonts though.
i mean the standard "fixed" X window fonts, that come with x.org and have a large variety of sizes. They are typically the default font for xterm. They are everywhere, in debian for example, so no problem with the license.
In the US at last check, bitmap fonts weren't subject to copyright. Also, the X11 fonts I've looked at had a license string something like "these glyphs are unencumbered".
I suspect those X11 bitmap fonts are in arcane 1980s formats that would require a chain of conversions-- from bitmap to vector to get them to Postscript Type 1 or TTF, and then from TTF to WOFF.
Yes, I’ve seen a lot with old formats. I don’t think the bitmaps themselves are a problem, I already have a bunch (maybe they are faux bitmap though, not sure actually). And they don’t need to be woff though, that just adds some compression and prevents installation. The latter of course not being an issue for the fonts that are featured here.
Doesn’t have Dina :P
Sadly, Dina is only available as a Windows FON file format, which I can't use or host in a web app.
There are at least 2 TTF conversions if you search around.

E.g. https://www.donationcoder.com/forum/index.php?topic=15281.0

Seems to be missing Computer Modern's Typewriter Text face (a.k.a. "CMU Typewriter Text"), which was my primary monospaced typeface (and still is on all except my work laptop, which I switched over to Fantasque Sans Mono since it's a better pairing with Comic Neue). It's a lovely font, the only fault being the lack of a slotted 0.
:/ The bitmap fonts are rendered with anti-aliasing. That's too bad. The advantage of bitmap fonts is how crisp they look. Here, they're pretty hard to read at small sizes.
Only if they aren't at their native point size. If you're on chrome, then you're right, because chrome renders how it wants, in classic "I know better than you" style.
Iosevka is the one that I always go back to: https://typeof.net/Iosevka/

Both the standard and slab versions are great

Holy smokes!

For as long as I’ve been coding, I’ve never heard of this font. Thanks for mentioning it.

This is definitely missing Dank: https://dank.sh

It's my favorite programming font, made by a good friend of mine. It has awesome ligatures and the italic version is beautiful, similar to Operator Mono!

An interesting font, but can't say I'm a fan of the regular 'f' extending down below the baseline. The italic style is fancy, but honestly feels a bit ostentatious (in particular I don't like the 's') to the point where I think the attempt to look pretty/handwritten interferes with its readability - especially at smaller sizes.
I really like it overall, but I think the f going below the baseline and the italic l not starting at the baseline would drive me crazy.

I wonder how hard it would be for me to change just those characters.

Easy. A basic font editor can do it. I for example experimented with changing the weight of parenthesis, thinking they're not evil in Lisp, just tuned badly for that purpose.
I have tried lots of different coding fonts for fun (and when I change fonts, it just feels like using a brand new computer :-)), but my go-to font when I just don’t want to think what I’m gonna using is SF Mono, from the San Francisco fonts by Apple[0].

It blends well with the macOS system fonts, and it’s great.

[0] https://developer.apple.com/fonts/

SF Mono is awesome. Using it for a long time.

The link you posted https://developer.apple.com/fonts offers to download and install .dmg -> .pkg. I usually install SF Mono via /Applications/Utilities/Terminal.app/Contents/Resources/Fonts. This folder contains all SF Mono fonts in .otf format. If you open them and install, it vill be available everywhere. You can copy those files and install it on Windows or Linux computer.

Also this extension is musthave: https://chrome.google.com/webstore/detail/advanced-font-sett... I set SF Mono as default monospaced font for chrome. IDK why ugly Courier font is still default in many software.

FYI If you just want to change the 'monospace' font in Chrome, you can do that from chrome://settings/fonts and don't need an extension (I changed it from Courier New to something nicer as well).
It’s good to see that many of these fonts distinguish well between open/close quote characters - this is a personal bugbear of mine. For example, Input Mono fails for me on this aspect. Hyphens and the two dashes are usually problematic, too - unfortunately, no examples of those in this post.