Jupyter Notebook (and JupyterLab) has two keyboard worlds: Command Mode, where keys manage cells themselves, and Edit Mode, where keys edit inside a cell. Blue border means Command Mode, green means Edit Mode — Esc and Enter switch between them. This complete list of Jupyter Notebook keyboard shortcut keys explains both modes in plain words.
Switching Modes and Running Cells
| Shortcut Key | Function |
|---|---|
| Esc | Enter Command Mode (from Edit Mode) |
| Enter | Enter Edit Mode for the selected cell |
| Shift + Enter | Run the cell and move to the next one |
| Ctrl + Enter | Run the cell and stay on it |
| Alt + Enter | Run the cell and insert a new cell below |
| Ctrl + S | Save the notebook |
| Ctrl + Shift + P (JupyterLab) | Open the Command Palette |
| Ctrl + Shift + C (classic Notebook) | Open the Command Palette |
| H (Command Mode) | Show the keyboard shortcuts help dialog |
Command Mode Shortcuts (managing cells)
| Shortcut Key | Function |
|---|---|
| Up / Down Arrow (or K / J) | Select the cell above / below |
| A | Insert a cell Above |
| B | Insert a cell Below |
| Y | Change the cell to Code |
| M | Change the cell to Markdown |
| R | Change the cell to Raw |
| 1 to 6 | Change the Markdown cell to Heading level 1–6 |
| D, D (press D twice) | Delete the selected cells |
| Z | Undo the last cell deletion |
| X | Cut the selected cells |
| C | Copy the selected cells |
| V | Paste cells below |
| Shift + V | Paste cells above |
| Shift + M | Merge the selected cells |
| Shift + Arrow keys | Extend the cell selection up/down |
| L | Toggle line numbers in the selected cells |
| Shift + L | Toggle line numbers in all cells |
| O | Toggle the cell output visibility |
| Shift + O | Toggle output scrolling for the cell |
| I, I (press I twice) | Interrupt the kernel (stop a running cell) |
| 0, 0 (press 0 twice) | Restart the kernel |
| Space / Shift + Space | Scroll the notebook down / up |
| S | Save the notebook |
Edit Mode Shortcuts (inside a cell)
| Shortcut Key | Function |
|---|---|
| Tab (with partial code) | Show code completion suggestions |
| Tab (on selected lines) | Indent the lines |
| Shift + Tab | Show the tooltip/help for the object (press twice for the full help) |
| Shift + Tab (on selected lines) | Dedent the lines |
| Ctrl + ] | Indent |
| Ctrl + [ | Dedent |
| Ctrl + / | Comment / uncomment the selected lines |
| Ctrl + Shift + - (minus) | Split the cell at the cursor |
| Ctrl + A | Select all the code in the cell |
| Ctrl + Z | Undo (inside the cell) |
| Ctrl + Shift + Z or Ctrl + Y | Redo |
| Ctrl + Left / Right Arrow | Move by word |
| Ctrl + Backspace / Ctrl + Delete | Delete the word before / after the cursor |
| Ctrl + Home / Ctrl + End | Move to the cell start / cell end |
| Alt + Up / Down Arrow (JupyterLab) | Move the current line up / down |
| Ctrl + D (JupyterLab) | Select the next occurrence (multi-cursor find match) |
| Esc | Back to Command Mode |
Tips for Jupyter Users
The run trio is everything: Shift + Enter (run + advance), Ctrl + Enter (run in place) and Alt + Enter (run + fresh cell below) cover 90% of notebook work. When a cell hangs, I I interrupts the kernel without losing variables; 0 0 restarts it clean. And Shift + Tab over any function name opens its documentation inline — the fastest way to check arguments without leaving the notebook.
Frequently Asked Questions
What is the difference between Command Mode and Edit Mode in Jupyter?
Edit Mode (green border) edits inside one cell; Command Mode (blue border) treats cells as objects — moving, copying, deleting and converting them. Esc enters Command Mode, Enter enters Edit Mode.
How do I run a cell and stay on it in Jupyter?
Press Ctrl + Enter. Shift + Enter runs and moves down; Alt + Enter runs and inserts a new empty cell below.
How do I delete a cell in Jupyter Notebook?
In Command Mode, select the cell and press D twice (D, D). Press Z to undo the deletion.
How do I stop a running cell in Jupyter?
Press I twice (I, I) in Command Mode to interrupt the kernel, or use the stop button in the toolbar — your variables stay intact.
By Umar Farooq, Tech Know.
0 Comments