Programming Ligatures: What They Are and Whether to Use Them
What programming font ligatures are
Programming font ligatures are a font feature that draws a sequence of characters, such as ->, <= or !=, as one joined glyph. The file does not change: you still type and save the same plain characters. Only the way your editor draws them changes.
Here is a line of code that shows the idea:
if (count != 0 && ratio >= 1) { return next => next }With ligatures on, !=, >= and => may appear as single symbols. With them off, you see the characters as typed.
A short history of ligatures
A ligature is, in the words of the Wikipedia entry on ligatures), "the combination of two or more graphemes or letters into one glyph". Familiar examples are æ, œ and fi. The ampersand (&) grew out of a ligature of the Latin letters e and t.
Ligatures are old. When movable type appeared around 1450, typefaces included many of them, because one piece of type could stand in for a frequent letter pair and keep the letters from colliding. The same page notes that standard ligatures exist to avoid errors such as character collision.
Code has its own typographic habits too. If you are curious about another one, see why code wraps at 80 columns. Programming ligatures are a newer chapter: the same old idea, applied to operators.
What ligatures do to your code
Rendering only
The Fira Code project, a free monospaced font with programming ligatures, is explicit about this: "This is just a font rendering feature: underlying code remains ASCII-compatible." Compilers, diffs, search and version control all see the characters you typed.
That also means a ligature can hide the truth about a file. The two characters behind a joined glyph are still there, just as with characters you can't see in a text file. If something behaves oddly, switch ligatures off and read the raw characters.
The readability argument
Fira Code's case is that programmers use many symbols that take several characters, and that "your eye spends a non-zero amount of energy to scan, parse and join multiple characters into a single logical one." A joined -> reads as one token, not a dash followed by a bracket.
The README also says this helps you read code faster, but it does not point to a study, so treat the claim as an argument, not a measurement. Some people scan ligatures faster. Others find them distracting. Both reactions are fair.
Where they can get in the way
These are judgment calls, not measurements:
- A joined glyph may look unlike what you would type, which can confuse someone learning the language.
- If you share screenshots or pair with someone whose editor shows plain characters, you are no longer looking at the same thing.
- Support varies. The Fira Code README keeps lists of editors and terminals where ligatures work and where they don't, so check before you rely on them.
How to turn ligatures on or off
In an editor
Most editors need two things: a font that includes programming ligatures, and a setting that allows them. Fira Code's wiki has per-editor instructions, for example for VS Code. If your editor has no switch, choosing a font without ligatures is the plain way to turn them off.
In CSS
On the web, the `font-variant-ligatures` property on MDN controls which ligatures and contextual forms are used. none disables all of them, even common ones. The contextual and no-contextual values map to the OpenType calt feature, which is the one programming fonts lean on.
/* Ligatures off in code blocks */
pre, code { font-variant-ligatures: none; }
/* Contextual forms on (what Fira Code's README suggests for CodeMirror) */
.editor { font-variant-ligatures: contextual; }Fira Code's README also shows font-feature-settings: "calt"; for older browsers such as IE 10+ and Edge Legacy. And if an editor cannot toggle features, the project lets you build a custom font with chosen features baked in, which is a bigger step than most people need.
Should you use them?
Treat it as a trial, not a decision. Use ligatures for a week on code you know well. If you catch yourself pausing on a symbol, or checking what it really says, turn them off. If operators scan faster, keep them.
Ligatures are one of several display choices that affect how code reads, along with line length and syntax theme contrast. The file stays plain text, so none of them can corrupt your work, and you can undo any of them.
How Carets fits in
Ligatures are a reading preference, and your files stay plain text whatever you pick. Carets is a native notes and code editor for iPhone, iPad and Mac, so you can read and edit code the same way on each device.
- Syntax highlighting for code and config files helps you read operators in context.
- Files, projects and tags keep your snippets organized without turning them into a proprietary format.
- Plain text, Markdown and code in one editor, so your files stay portable.
Carets is a lightweight editor, not a full IDE. If you need a debugger or a compiler, use the right tool for that. For quick edits, notes and snippets on Apple devices, it is a good fit.
Get Carets on the App Store for iPhone, iPad and Mac.
Frequently Asked Questions
Do ligatures change my code?
No. A ligature is a rendering effect. The file still holds the same plain ASCII characters, so compilers, diffs and search see exactly what you typed.
Do ligatures make code easier to read?
Fira Code argues they do, because a multi-character operator reads as one token. The project offers no user study, so treat it as a preference you can test on your own code.
How do I turn ligatures off?
Switch to a font without them, use your editor's ligature setting if it has one, or in CSS set font-variant-ligatures: none.
Do all editors support programming ligatures?
No. Support varies by editor and terminal, and the Fira Code README keeps lists of what works and what doesn't.