You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A "tight layout" mode that reduces vertical spacing #175295
A design with generous vertical spacing looks nice on big screens.
However, on a small Laptop screen, it's in my opinion better to have a tighter layout to fit more lines of code on the screen.
Therefore, it would be nice to have a "tight layout" mode, that reduces vertical spacing in a notebook.
I've made 4 screenshots from the same notebook to show how vertical spacing is varying from platform to platform (and VSCode wins the contest of largest white space areas):
Jan-Hendrik Müller (@kolibril13) thanks for your feedback. This has been brought up multiple times and we can see the value of having a more compact view for notebook editor.
The main reason VS Code's default notebook view has more spacing is it renders more components than the Jupyter Notebook, including
A toolbar to insert between cells
A breadcrumb to show the TOC of the notebook file and cell
Cell toolbar which allows you to run operations against the target cell
Cell status bar for execution state and cell language
If we disable these components (the functionalities are still available through commands, or through other components) with following settings
changing the editor line height to be the same as Jupyter Notebook (17px)
and I actually get slightly more content rendered than Jupyter Notebook ;). It's not fair comparison as the browser renders the omnitoolbar and Jupyter Notebook renders a menubar (while VS Code's menus are in the system menubar)
Thanks Peng Lyu (@rebornix) for your quick response and so many great suggestions!
And congrats for winning the "more content rendered than in Jupyter Lab" challenge with VSCode! ;)
I think it's really situation dependent when one prefers more functions, and when one prefers more space.
Maybe there can be a switch command that toggles all these settings at once?
Regarding from your comment above:
A toolbar to insert between cells
A breadcrumb to show the TOC of the notebook file and cell
Cell toolbar which allows you to run operations against the target cell
I totally agree with this, these are nice to have, but also dispensable as there are good alternatives.
Cell status bar for execution state and cell language
In my opinion, the execution state is an important feature.
Maybe this can be shifted up in "tight layout" mode, so that it does not occupy extra vertical space?
In JupyterLab, there is the [*] that indicates cell execution.
And the cell language: How about shifting this to the right bottom corner of the last code line in "tight layout" mode?
But cell language is also not very important to have in a "tight layout" mode, I think.
I've tested your parameters, and it's a huge difference! Thanks a lot for providing these settings! :)
Here is a before/after image comparison:
Screen.Recording.2023-02-24.at.20.40.58.mov
Do we want to take this challenge even further and once test out the tightest vertical spacing that does not harm the readability?
I just took your reduced spaced layout and drew some red lines where I can see potential to further reduce the size:
A few pixels less at the beginning of a cell.
A few pixels less at the ending of a cell.
A few pixel less between the outputs.
Maybe it might look cluttered then, but it would be interesting to see if this was possible.
Reacted by Jack McIvor, NiteshRijhwani, Victor Negîrneac and Thomas Wayne
Jan-Hendrik Müller (@kolibril13) I like the screenshot you posted above very much. You did figure out the padding we added around those components, great work!
A few pixels less at the beginning of a cell.
A few pixels less at the ending of a cell.
We always add a few pixels around the cell editor. The text editor has settings to control the top/bottom padding, so we might consider adding the same set of settings for notebook.
Jan-Hendrik Müller (@kolibril13) I like the screenshot you posted above very much. You did figure out the padding we added around those components, great work!
A few pixels less at the beginning of a cell.
A few pixels less at the ending of a cell.
We always add a few pixels around the cell editor. The text editor has settings to control the top/bottom padding, so we might consider adding the same set of settings for notebook.
I put together a VSCode extension that, among other goals (unrelated to this issue), provides a command to configure the notebook layout to a compact mode by simply setting the corresponding users settings that already exist in VSCode (no new settings are added). After you install the extension it will suggest to apply the compact mode. You might find useful its other features: pairing notebooks via Jupytext and inserting/toggling notebook cells to raw "type".
If you want to give it a spin, you can grab it from the Marketplace or install the latest .vsix from the repo’s releases page:
Hi there! thanks for making this. just tested your extension, and the control somehow only creates the space on the left side of the cell, and not the space between the space. Is it also possible to control that space as well?
Hi there! thanks for making this. just tested your extension, and the control somehow only creates the space on the left side of the cell, and not the space between the space. Is it also possible to control that space as well?
My extension just provides a shortcut to set some notebook.* configs (that were mentioned in this issue on how to use existing configurations) to make the layout more compact. Sadly my extension does not provide new configuration options affecting the notebook layout.
The "Compact View" is a notebook setting that already exists and sadly it does not reduce the spacing 🥲
Each notebook code cell has a hardcoded 12px top padding inside the Monaco editor. For a single-line cell with editor.lineHeight: 16, the cell renders at 40px total — the 16px code line starts at top: 12px within a 40px overflow-guard. Almost 60% of the cell height is empty space.
Custom CSS injection doesn't work either — the .cell-inner-container, .cell-focus-indicator-top, and .cell-focus-indicator-bottom elements already have 0px padding/margin. The 12px is set inline by the Monaco layout engine on the .view-line elements and recalculated on every render, so CSS overrides get immediately clobbered.
I think editor.padding.top / editor.padding.bottom should be respected by notebook cell editors (either directly or via notebook.editorOptionsCustomizations). This would let users who want a compact layout opt in without changing the default for anyone else. A single "tight layout" toggle that reduces both the internal cell padding and the between-cell spacing would be even better.
This is a significant usability issue for data scientists working on laptops — the vertical space overhead per cell makes VS Code notebooks noticeably less information-dense than JupyterLab, exactly as the original screenshots demonstrate.
Reacted by Jack McIvor, Victor Negîrneac and raph-p
Activity
amunger commentedon Feb 24, 2023
related, but for IW: #156803
rebornix commentedon Feb 24, 2023
Jan-Hendrik Müller (@kolibril13) thanks for your feedback. This has been brought up multiple times and we can see the value of having a more compact view for notebook editor.
The main reason VS Code's default notebook view has more spacing is it renders more components than the Jupyter Notebook, including
If we disable these components (the functionalities are still available through commands, or through other components) with following settings
VS Code
Chrome/Jupyter Notebook

Jan-Hendrik Müller (@kolibril13) do you wanna give the settings a try and see how they work for you?
rebornix commentedon Feb 24, 2023
I pushed this a bit more by
and I actually get slightly more content rendered than Jupyter Notebook ;). It's not fair comparison as the browser renders the omnitoolbar and Jupyter Notebook renders a menubar (while VS Code's menus are in the system menubar)
and here are all the notebook settings I tweaked
kolibril13 commentedon Feb 24, 2023
Thanks Peng Lyu (@rebornix) for your quick response and so many great suggestions!
And congrats for winning the "more content rendered than in Jupyter Lab" challenge with VSCode! ;)
I think it's really situation dependent when one prefers more functions, and when one prefers more space.
Maybe there can be a switch command that toggles all these settings at once?
Regarding from your comment above:
I totally agree with this, these are nice to have, but also dispensable as there are good alternatives.
In my opinion, the execution state is an important feature.
Maybe this can be shifted up in "tight layout" mode, so that it does not occupy extra vertical space?
In JupyterLab, there is the [*] that indicates cell execution.
And the cell language: How about shifting this to the right bottom corner of the last code line in "tight layout" mode?
But cell language is also not very important to have in a "tight layout" mode, I think.
I've tested your parameters, and it's a huge difference! Thanks a lot for providing these settings! :)
Here is a before/after image comparison:
Screen.Recording.2023-02-24.at.20.40.58.mov
Do we want to take this challenge even further and once test out the tightest vertical spacing that does not harm the readability?
I just took your reduced spaced layout and drew some red lines where I can see potential to further reduce the size:
Maybe it might look cluttered then, but it would be interesting to see if this was possible.
rebornix commentedon Feb 28, 2023
Jan-Hendrik Müller (@kolibril13) I like the screenshot you posted above very much. You did figure out the padding we added around those components, great work!
We always add a few pixels around the cell editor. The text editor has settings to control the top/bottom padding, so we might consider adding the same set of settings for notebook.
We might want to check the default padding we use for outputs cc Aaron Munger (@amunger)
username7171 commentedon Sep 4, 2023
Any updates on these features?
YubinXie commentedon Nov 3, 2023
I find switching this setting to hidden helps the most.

starball5 commentedon Mar 16, 2024
Historically related: #101366
starball5 commentedon Feb 19, 2025
Related on Stack Overflow: Is there a compact view for notebooks in VS code? Cells waste too much empty space
caenrigen commentedon May 6, 2025
Hi all,
I put together a VSCode extension that, among other goals (unrelated to this issue), provides a command to configure the notebook layout to a compact mode by simply setting the corresponding users settings that already exist in VSCode (no new settings are added). After you install the extension it will suggest to apply the compact mode. You might find useful its other features: pairing notebooks via Jupytext and inserting/toggling notebook cells to raw "type".
If you want to give it a spin, you can grab it from the Marketplace or install the latest
.vsixfrom the repo’s releases page:Feel free to try it out and let me know on the issue tracker if you hit any issues
kolibril13 commentedon May 6, 2025
Hi there! thanks for making this. just tested your extension, and the control somehow only creates the space on the left side of the cell, and not the space between the space. Is it also possible to control that space as well?

caenrigen commentedon May 6, 2025
Jan-Hendrik Müller (@kolibril13) sorry if my initial comment was misleading
My extension just provides a shortcut to set some
notebook.*configs (that were mentioned in this issue on how to use existing configurations) to make the layout more compact. Sadly my extension does not provide new configuration options affecting the notebook layout.The "Compact View" is a notebook setting that already exists and sadly it does not reduce the spacing 🥲
alexlenail commentedon Feb 22, 2026
Each notebook code cell has a hardcoded 12px top padding inside the Monaco editor. For a single-line cell with
editor.lineHeight: 16, the cell renders at 40px total — the 16px code line starts attop: 12pxwithin a 40pxoverflow-guard. Almost 60% of the cell height is empty space.none of these work:
Custom CSS injection doesn't work either — the
.cell-inner-container,.cell-focus-indicator-top, and.cell-focus-indicator-bottomelements already have 0px padding/margin. The 12px is set inline by the Monaco layout engine on the.view-lineelements and recalculated on every render, so CSS overrides get immediately clobbered.I think
editor.padding.top/editor.padding.bottomshould be respected by notebook cell editors (either directly or vianotebook.editorOptionsCustomizations). This would let users who want a compact layout opt in without changing the default for anyone else. A single "tight layout" toggle that reduces both the internal cell padding and the between-cell spacing would be even better.This is a significant usability issue for data scientists working on laptops — the vertical space overhead per cell makes VS Code notebooks noticeably less information-dense than JupyterLab, exactly as the original screenshots demonstrate.