Jupyter Notebook keyboard shortcuts for Windows, Linux and Mac

Default keyboard shortcuts of Jupyter Notebook 7.6.3 and JupyterLab 4.6.4, the release it is built on, read from the schema files defining them, in a Windows / Linux and a Mac column. A notebook has two modes: command mode, where single letters such as A or M act on cells, and edit mode, where keys type into the cell. Tab, sidebar and file browser shortcuts belong to the JupyterLab workspace; a Notebook 7 notebook page does not register them.

160 shortcuts in 14 sections. Checked row by row against JupyterLab 4.6.4 source (tag v4.6.4) on . Edited by Jay.

Command mode navigation 16

The schema files write most modifier shortcuts with Accel, which is Cmd on a Mac and Ctrl on Windows and Linux. A binding written with a literal Ctrl, such as the heading and cell-moving keys, stays on Ctrl on a Mac.

ActionWindows / LinuxMac
Enter Edit ModePuts the text cursor in the selected cell; the cell border turns blue.EnterReturn
Extend Selection AboveAdds the neighbouring cell to the selection so several cells can be cut, moved or merged together.Shift+UpShift+Up
Extend Selection AboveLetter alternative to Shift with the Up arrow.Shift+KShift+K
Extend Selection to TopSelects everything from the current cell up to the first cell of the notebook.Shift+HomeShift+Home
Extend Selection BelowShift+DownShift+Down
Extend Selection to BottomSelects everything from the current cell down to the last cell of the notebook.Shift+EndShift+End
Extend Selection BelowLetter alternative to Shift with the Down arrow.Shift+JShift+J
Select Cell BelowDownDown
Select Cell BelowLetter alternative to the Down arrow, active only while the notebook is in command mode.JJ
Select Cell AboveUpUp
Select Cell AboveLetter alternative to the Up arrow, active only while the notebook is in command mode.KK
Go to heading above or collapseEither folds the section under the current heading cell or jumps to the previous heading.LeftLeft
Go to heading below or expandEither unfolds the section under the current heading cell or jumps to the following heading.RightRight
Collapse All HeadingsFolds every section of the notebook under its heading cell; Ctrl stays Ctrl on a Mac.Ctrl+Shift+LeftCtrl+Shift+Left
Expand All HeadingsCtrl+Shift+RightCtrl+Shift+Right
Select All CellsBound for command mode only, so it selects cells rather than the text of one cell.Ctrl+ACmd+A

Cell operations 17

ActionWindows / LinuxMac
Copy CellCC
Cut CellXX
Delete CellA two-key sequence: press D twice while the notebook is in command mode.DthenDDthenD
Insert Cell AboveAA
Insert Cell BelowBB
Merge Selected CellsShift+MShift+M
Merge Cell AboveJoins the current cell with its upper neighbour; written with Ctrl for every system.Ctrl+BackspaceCtrl+Backspace
Merge Cell BelowJoins the current cell with its lower neighbour; written with Ctrl for every system.Ctrl+Shift+MCtrl+Shift+M
Paste Cell BelowInserts the cut or copied cells under the current one.VV
Redo Cell OperationShift+ZShift+Z
Show Line NumbersCommand mode toggle for the line numbers in cell editors.Shift+LShift+L
Split CellThe one cell operation bound in edit mode: the cell is divided where the text cursor stands.Ctrl+Shift+-Ctrl+Shift+-
Undo Cell OperationReverses the last change made to cells, not text typed inside a cell.ZZ
Render Side-by-SideToggles side-by-side rendering for the current notebook only.Shift+RShift+R
Move Cell UpCtrl+Shift+UpCtrl+Shift+Up
Move Cell DownCtrl+Shift+DownCtrl+Shift+Down
Toggle output visibilityAdded by Notebook 7 in its own schema; JupyterLab ships the command without a default key.OO

Cell types and headings 11

ActionWindows / LinuxMac
Change to Code Cell TypeYY
Change to Heading 1Number keys 1 to 6 set the heading level and respond only while a Markdown cell has focus.11
Change to Heading 222
Change to Heading 333
Change to Heading 444
Change to Heading 555
Change to Heading 666
Change to Markdown Cell TypeMM
Change to Raw Cell TypeRR
Insert Heading AboveAdds a new heading cell above the heading that the current cell belongs to.Shift+AShift+A
Insert Heading BelowShift+BShift+B

Running cells and kernel 6

ActionWindows / LinuxMac
Interrupt KernelPress I twice; ignored while focus is in an editable field, so use it from command mode.IthenIIthenI
Restart KernelPress 0 twice; ignored while focus is in an editable field, so use it from command mode.0then00then0
Run SelectedRun menu binding for any element marked as a code runner; this is what makes the keys work in command mode.Shift+EnterShift+Return
Run cell and stayBound in both modes; a Mac accepts Ctrl with Return as well as Cmd.Ctrl+EnterCmd+ReturnorCtrl+Return
Run and insert cell belowBound in both modes; a fresh cell appears under the one that was executed.Alt+EnterOption+Return
Run cell and advanceEdit mode binding: executes the cell, then moves the selection to the following cell.Shift+EnterShift+Return

Edit mode 8

ActionWindows / LinuxMac
Open completionsBrings up the completer in a cell editor, except when the cursor is at the start of a line.TabTab
Enter Command ModeLeaves the cell editor; single letters then act on cells and the border turns gray.EscEsc
Enter Command ModeSecond binding beside Esc; it uses Ctrl on a Mac too.Ctrl+MCtrl+M
Previous kernel history entrySteps back through code the kernel has already executed while a cell is being edited.Alt+UpOption+Up
Next kernel history entryAlt+DownOption+Down
Dismiss tooltipApplies while a tooltip is open over a notebook cell.EscEsc
Show tooltipNeeds a cursor past the leading whitespace, no selected text and a closed completer.Shift+TabShift+Tab
Insert chosen completionApplies while the completer list is open; added by application code, so no schema file lists it.EnterReturn

Code editor 16

The same keys can carry two commands with different selectors, and the binding whose selector matches nearest to the focused element runs. That is why one combination deletes a line in an editor and opens a sidebar elsewhere.

ActionWindows / LinuxMac
Delete lineRemoves the whole line under the cursor in any CodeMirror editor: cells, consoles and text files.Ctrl+DCmd+D
Delete lineSecond binding; in an editor it takes precedence over the Table of Contents shortcut on the same keys.Ctrl+Shift+KCmd+Shift+K
Toggle Block CommentAlt+AOption+A
Toggle CommentCtrl+/Cmd+/
Select Next OccurrenceIn an editor these keys add the following match to the selection, not Simple Interface mode.Ctrl+Shift+DCmd+Shift+D
Toggle BoldMarkdown editors only: wraps the selected text in double asterisks, or removes them.Ctrl+BCmd+B
Next Inline CompletionAlt+]Option+]
Previous Inline CompletionAlt+[Option+[
Accept Inline CompletionApplies only while an inline suggestion is showing.TabTab
Accept Inline CompletionAlternative to Tab while an inline suggestion is showing.Alt+EndOption+End
Invoke Inline CompleterRequests an inline suggestion at the cursor; bound wherever a completer is enabled.Alt+\Option+\
Open completions in a text fileSame completer as in notebooks, bound for the file editor; inactive at the start of a line.TabTab
Redo text editWindows and Linux also accept Ctrl with Y, which the schema lists as a separate entry.Ctrl+Shift+ZorCtrl+YCmd+Shift+Z
Undo text editEditor-level undo, separate from the single-letter cell undo of command mode.Ctrl+ZCmd+Z
Show tooltip in a text fileFile editor binding; it needs a cursor past the indentation and no selected text.Shift+TabShift+Tab
Insert completion in a text fileFile editor binding that applies while the completer list is open.EnterReturn

Find and replace 6

ActionWindows / LinuxMac
Find in documentOpens the built-in search of JupyterLab in any searchable document, replacing the browser search.Ctrl+FCmd+F
Find and ReplaceCtrl+HCmd+H
Find NextCtrl+GCmd+G
Find PreviousCtrl+Shift+GCmd+Shift+G
Search in SelectionAvailable while a search is active; limits matching to the current selection.Alt+LOption+L
End SearchCloses the search box while a search is active.EscEsc

Files and documents 8

ActionWindows / LinuxMac
Close TabCloses the main-area activity that has focus; it uses Option on a Mac.Alt+WOption+W
Print documentCtrl+PCmd+P
Save documentCtrl+SCmd+S
Save AsCtrl+Shift+SCmd+Shift+S
Close and Shut DownThe schema writes Ctrl, not Accel, so a Mac uses Ctrl here too.Ctrl+Shift+QCtrl+Shift+Q
Reopen Closed DocumentCtrl+Shift+TCmd+Shift+T
Open Settings EditorCtrl+,Cmd+,
Save User SettingsInside the Settings Editor the save keys store the edited settings.Ctrl+SCmd+S

File browser 9

ActionWindows / LinuxMac
Go UpOpens the parent folder while the file list has focus.BackspaceBackspace
Delete itemThe JupyterLab command list labels this command Move to Trash.DeleteDelete
Cut itemCtrl+XCmd+X
Copy itemCtrl+CCmd+C
Paste itemCtrl+VCmd+V
Rename itemF2F2
Duplicate itemOn a selected file these keys make a copy; in an editor they delete a line.Ctrl+DCmd+D
Select All itemsCtrl+ACmd+A
Show File BrowserToggles the main file browser panel; bound on the whole page.Ctrl+Shift+FCmd+Shift+F

Tabs and layout 12

Notebook 7 loads the JupyterLab plugin behind the tab and sidebar shortcuts only on its file browser page, so its notebook, console and editor pages do not register them.

ActionWindows / LinuxMac
Activate Next TabWritten with Ctrl in the schema, so a Mac uses Ctrl here, not Cmd.Ctrl+Shift+]Ctrl+Shift+]
Activate Previous TabCtrl+Shift+[Ctrl+Shift+[
Activate Next Tab BarCtrl+Shift+.Ctrl+Shift+.
Activate Previous Tab BarCtrl+Shift+,Ctrl+Shift+,
Simple InterfaceSwitches JupyterLab between the multi-tab layout and one document at a time.Ctrl+Shift+DCmd+Shift+D
Show Left SidebarShows or hides the left sidebar; in a Markdown editor the same keys toggle bold.Ctrl+BCmd+B
Show Right SidebarCtrl+JCmd+J
Fullscreen ModeWhile the debugger is stopped at a breakpoint F11 steps in instead.F11F11
Activate Command PaletteOpens the searchable list of every command, the keyboard route to actions without a binding.Ctrl+Shift+CCmd+Shift+C
Show Keyboard ShortcutsLists the bindings relevant to the widget that is active at that moment.Ctrl+Shift+HCmd+Shift+H
New LauncherCtrl+Shift+LCmd+Shift+L
Activate Previously Used TabJumps back to the tab that had focus before the current one.Ctrl+Shift+'Cmd+Shift+'

Debugger 9

ActionWindows / LinuxMac
Debugger PanelCtrl+Shift+ECmd+Shift+E
Continue or pauseBound on the whole page, unlike the step keys, which need a stopped thread.F9F9
Terminate debuggingShift+F9Shift+F9
Step over (Next)Active only while the debugger has a stopped thread.F10F10
Step InWith a stopped thread F11 steps into the call; otherwise it toggles fullscreen mode.F11F11
Step OutShift+F11Shift+F11
Run line in debug consoleEvaluates the input of the debug console prompt; added by debugger code, not a schema file.Shift+EnterShift+Return
Open completions in debug consoleTabTab
Insert completion in debug consoleApplies while the completer list of the debug console is open.EnterReturn

Console 8

ActionWindows / LinuxMac
Open completions at the promptConsole prompt binding of the completer; inactive at the start of a line.TabTab
Run Cell (forced)Bound in both console interaction modes, notebook and terminal.Shift+EnterShift+Return
Insert Line BreakTerminal interaction mode only, where plain Enter is taken by the run command.Ctrl+EnterCmd+Return
Run Cell (unforced)Applies only when the console interaction mode is set to terminal.EnterReturn
Dismiss tooltip at the promptCloses the open tooltip of a console prompt.EscEsc
Show tooltip at the promptConsole prompt binding; it needs a cursor past the indentation and no selected text.Shift+TabShift+Tab
Open scratchpad consoleNotebook 7 only, on notebook, console and editor pages; JupyterLab uses these keys for the left sidebar.Ctrl+BCmd+B
Insert completion at the promptTakes over Enter while the completer list is open in a console.EnterReturn

Image viewer 8

ActionWindows / LinuxMac
Flip horizontallyBound only while an image viewer tab has focus.HH
Flip verticallyVV
Invert ColorsII
Reset Image00
Rotate Clockwise]]
Rotate Counterclockwise[[
Zoom In==
Zoom Out--

Notes

→ Related guide: Keyboard shortcuts every data scientist should know

Command mode

Press Esc to leave the cell editor; the cell border turns gray, and blue again once you are back in Edit mode. Then A and B insert a cell above or below, D, D (D pressed twice) deletes the selected cell, M turns it into Markdown and Y back into code. C, X and V copy, cut and paste whole cells, and Shift with the arrow keys selects several so they can be moved or deleted together. Enter returns to Edit mode in the selected cell.

Running

Shift + Enter runs the cell and selects the next one — pressing it repeatedly walks down a notebook — while Ctrl + Enter runs and stays, which is what you want when re-running one cell while tuning a parameter. Alt + Enter runs and inserts an empty cell below. All three work in both modes. On a Mac, run-and-stay answers to Cmd + Return as well as Ctrl + Return, and run-and-insert is Option + Return. Interrupting a running cell is I, I in Command mode, and 0, 0 restarts the kernel.

Inside a cell

In Edit mode, Tab opens the completer and Shift + Tab shows a tooltip for the code at the cursor. Ctrl + / toggles a comment on the selected lines (Cmd + / on a Mac). Because the editor captures most keys in Edit mode, cell operations do not work there — if A inserts a letter instead of a cell, press Esc first.

Questions

Which Jupyter shortcuts keep Ctrl on a Mac?

JupyterLab writes most modifier shortcuts with Accel, which is Cmd on a Mac and Ctrl on Windows and Linux. Bindings written with a literal Ctrl stay on Ctrl everywhere: Ctrl + M to enter command mode, Ctrl + Shift + - to split a cell, Ctrl + Shift + Up to move a cell up, and the tab-switching keys such as Ctrl + Shift + ]. Alt bindings use the Option key.

Do these shortcuts apply to Notebook 7 or to JupyterLab?

To both. Notebook 7.6.3 is built from JupyterLab 4.6.4 components and reads the same schema files, so the notebook, editor, search, console and debugger bindings are identical. Notebook 7 adds O to toggle cell outputs and uses Ctrl + B for its scratchpad console, and its notebook page does not register the tab, sidebar and file browser shortcuts of JupyterLab.

Why does a letter key or D, D do nothing in my notebook?

Single-letter shortcuts are bound to command mode only. While the cursor is inside a cell the keys type text, so press Esc first; the same holds for two-key sequences such as D, D and I, I.

Sources and checks

29 more source pages

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.