The VS Code Font Size Keybinding I Wish I'd Set Up Years Ago
I spent way too long opening Settings and dragging VS Code's editor font size up and down by hand. Embarrassingly long. Years. I'd be skimming a 600-line file, realise I couldn't see its shape, click into Settings, change editor.fontSize from 16 to 13, save, look around, and a few minutes later do the whole thing in reverse so I could actually read what I was typing.
I knew about Ctrl++ and Ctrl+-. That wasn't the fix.
The short version: if you want one keystroke that toggles only the editor font size between two (or more) values — leaving the sidebar, tabs, status bar, and terminal exactly where they are — install the Toggle extension by rebornix and add a single entry to your keybindings.json. The whole setup takes about three minutes. The rest of this post is the why and the what else this pattern unlocks.
Why Ctrl+Plus doesn't actually solve this
Ctrl++ doesn't change editor.fontSize. It changes window.zoomLevel, which scales the entire VS Code UI: sidebar, title bar, status bar, terminal, breadcrumbs, tabs — everything moves together.
That's the right behaviour if your goal is "make the whole UI bigger because my eyes are tired." It's the wrong behaviour if your goal is "I want my code to be one size sometimes and another size other times, and I want everything else to stay where it is."
Two different goals. VS Code ships a shortcut for the first one and effectively nothing for the second.
Here's how the three settings differ:
| Setting | What it changes | Has a built-in keybinding? |
|---|---|---|
window.zoomLevel | Entire VS Code UI | Yes — Ctrl++ / Ctrl+- |
editor.fontSize | Only the code editor text | No |
editor.lineHeight | Vertical spacing in the editor | No |
The interesting gap is the middle row. There's no shipped command for "set editor.fontSize to a specific value from a keybinding." You can change settings; you can bind keys to commands; you can't natively bind a key to "set this setting to that value."
You can almost do it with runCommands and a chain of internal command calls — VS Code added that primitive in 2023 — but the resulting JSON is brittle, easy to break on minor updates, and ugly enough that you'll forget how it works inside a week. There's a cleaner way.
The two-mode setup
What I actually wanted was two sizes for two different modes.
Scanning mode — 13px. When I'm trying to figure out the shape of a file I've never seen, or hunting for the function I half-remember writing last Tuesday, density matters. I want to see more lines at once. The cost of squinting a little is worth the extra context.
Focus mode — 16px. Pair programming. Screen sharing on a call. Late at night when my eyes are giving up. Writing a tricky function where I want each line to feel deliberate.
Two modes. One toggle.
The fix: Toggle by rebornix
Toggle is a small open-source extension by Peng Lv (publisher: rebornix). It does exactly one thing: it lets a single keybinding cycle a named setting — or group of settings — through a list of values. No UI, no settings page, just a primitive you wire into your own keybindings.
Install it, then drop this into your keybindings.json (open the Command Palette → Preferences: Open Keyboard Shortcuts (JSON)):
{
"key": "ctrl+k ctrl+k",
"command": "toggle",
"when": "editorTextFocus",
"args": {
"id": "fontSize",
"value": [
{ "editor.fontSize": 16, "editor.lineHeight": 24 },
{ "editor.fontSize": 13, "editor.lineHeight": 0 }
]
}
}
A few details worth unpacking.
id is just a label — it's how Toggle remembers where you are in the cycle, so each press advances to the next entry. Use any string you like; just keep it unique per binding.
value is an array of objects, and each object can change multiple settings at once. That's why line height sits alongside font size here. On a high-DPI monitor, 16px code wants a bit of breathing room; 13px wants whatever VS Code thinks is reasonable.
editor.lineHeight: 0 is the value that tells VS Code to compute line height automatically from the font size. The official setting description has said so since at least VS Code 1.10: "Use 0 to compute the lineHeight from the fontSize." A positive integer (like 24) sets it explicitly in CSS pixels. Tune all four of these numbers to your screen, your eyes, and your monospaced font of choice; what works on a 27-inch monitor isn't what works on a laptop on a plane.
when: "editorTextFocus" keeps the binding quiet when you're typing in the terminal, the search box, or the command palette. Remove it if you'd rather have the toggle work everywhere.
Choosing the keybinding
I picked Ctrl+K Ctrl+K — a chord, two presses in sequence — because it lives in the same family as VS Code's other Ctrl+K shortcuts (delete line, open keyboard shortcuts, close other editors), my fingers find it without thinking, and it doesn't collide with anything I personally use day to day.
Yours might be different. Alt+F is fine. So is Ctrl+; if your muscle memory hasn't been claimed by Vim or a linter. The Keyboard Shortcuts UI (Ctrl+K Ctrl+S) will flag conflicts if you pick something already bound.
The bigger pattern
The values I'm using aren't a prescription. Three sizes instead of two? Add a third object to the array; Toggle will cycle through all of them. Different fonts for the two modes, not just sizes? Add editor.fontFamily to each object. One mode that turns the minimap on and one that turns it off? Same trick.
That's the part I find most interesting. Once Toggle is installed, the same pattern works for:
- Themes — a light/dark cycle for daylight vs. late nights
- Word wrap —
editor.wordWrapbetween"off"and"on" - Font ligatures — on for prose, off when you want to see raw operators
- Minimap, breadcrumbs, sticky scroll — anything driven by a boolean
- Activity bar location —
workbench.activityBar.locationbetween"default"and"hidden"
I have a separate keybinding that cycles between two themes and I haven't opened the theme picker in months.
Why this matters more than it looks
None of this changes how I write code. The substance of the work is the same.
But the friction of opening Settings to nudge a number was a tax I was paying ten times a day, and it's gone. Multiply that by working days in a year and it stops being a rounding error. More importantly, it lowers the activation energy for reshaping the editor when the task changes — and once that's cheap, you'll do it more often, and the editor will fit the work better than it did before.
If you've been doing the same dance with editor.fontSize, give it twenty minutes. Worst case, you uninstall the extension and you're back where you started.
Key takeaways
Ctrl++zooms the whole UI viawindow.zoomLevel. To resize only the code, changeeditor.fontSize.- VS Code has no built-in command for "set this setting to that value" from a keybinding.
- The Toggle extension by
rebornixprovides exactly that primitive — cycle one or more settings through a list of values. editor.lineHeight: 0tells VS Code to compute line height automatically from the font size; any positive integer overrides it in pixels.- The same pattern works for themes, word wrap, ligatures, minimap, and anything else exposed as a setting.
FAQ
Does the Toggle extension work on macOS, Linux, and the Windows build of VS Code?
Yes. Toggle only manipulates user settings, so it works on every platform VS Code runs on, including remote and WSL contexts. The keybinding syntax changes (cmd instead of ctrl on macOS) — the extension itself doesn't.
Will this affect Settings Sync across machines?
Toggle writes to the same settings.json VS Code already manages. If you have Settings Sync turned on, the cycled values will propagate to your other machines as normal.
What if I prefer not to install an extension?
You can approximate the same effect using the built-in runCommands (added to VS Code in 2023) chained with workbench.action.openSettingsJson, or by switching profiles. Both are noticeably more brittle than Toggle and break more often on updates. For a single setting toggle, the extension is the lower-maintenance choice.
Why Ctrl+K Ctrl+K specifically?
Two reasons: it fits the family of existing Ctrl+K chords in VS Code, and the symmetry makes it easy to remember. There's nothing magic about it — pick whatever combination your fingers can find without looking.
Can I cycle more than two values?
Yes. Each entry in the value array is one stop in the cycle. Three entries means three modes; ten entries means ten. The id field is how Toggle tracks where you are.