⌥+⌃AltPlusCtrl

Jupyter Notebook Command Mode Shortcuts

Command mode is Jupyter's structural, cell-level editing state — the selected cell shows a blue left border, and every letter key becomes a command rather than typed text, since your cursor isn't actually inside the cell's content at all. This category covers everything about inserting, deleting, converting, copying, reordering, and multi-selecting cells as whole units.

ActionWindowsMacDescription
Insert cell aboveA (Command mode)AInserts a new empty cell directly above the currently selected one, only functional in Command mode — pressing A while actively editing text inside a cell just types the letter A instead.
Insert cell belowB (Command mode)BInserts a new empty cell directly below the currently selected one, the far more commonly used of the two insert directions since most workflows build downward.
Delete selected cellD, D (press twice)D, DDeletes the currently selected cell, requiring the D key pressed twice in quick succession as a deliberate guard against accidental single-keystroke deletion of cell content.
Convert cell to MarkdownM (Command mode)MChanges the currently selected cell's type from code to Markdown, letting it render formatted text, headings, and links instead of being executed as code.
Convert cell to CodeY (Command mode)YChanges the currently selected cell's type back to Code, the reverse of converting to Markdown.
Copy selected cellC (Command mode)CCopies the entire selected cell (code and output) to Jupyter's internal clipboard, separate from the OS clipboard, for pasting elsewhere in the notebook with V.
Extend cell selection up/downShift+J / Shift+K (Command mode)Shift+J / Shift+KExtends the current cell selection to include the next or previous cell as well, letting you select several adjacent cells at once for a bulk action like deleting or moving them together.
Merge selected cellsShift+M (Command mode)Shift+MCombines the currently selected cells (extended via Shift+J/K) into a single cell, concatenating their content, useful for consolidating what was originally split across several small cells during exploratory work.
Undo last cell operationZ (Command mode)ZUndoes the most recent cell-level operation (like an accidental delete), distinct from Ctrl+Z inside Edit mode which undoes text-editing changes within a cell rather than structural cell operations.
Move selected cell upCtrl+Shift+Up (or use the toolbar arrow icon)Relocates the currently selected cell one position earlier in the notebook, reordering it without needing to cut and paste its content into a new location manually.
Inserting cells (A for above, B for below) adds a new empty cell relative to whichever one is currently selected. B sees far more everyday use than A simply because most notebook work builds downward — writing one cell, running it, then continuing with the next step directly below — while A is reserved for the less common case of realizing you need to insert an earlier setup step above something you've already written. Deleting a cell (D, D — the D key pressed twice in quick succession) is deliberately not a single keystroke, and this double-tap requirement is a genuine safety feature rather than an arbitrary design choice: a single accidental D press while in Command mode does nothing at all, giving you a brief window to realize you didn't mean to delete before a second D actually commits to it. This matters because Command mode's letter-key shortcuts fire immediately with no confirmation dialog, unlike a typical "are you sure you want to delete this" prompt some other software would show. Converting cell type (M for Markdown, Y for Code) changes what a cell actually does when run — a Markdown cell renders formatted text, headings, and links instead of being executed as code, useful for narrating a notebook's logic in prose between the actual code cells. This distinction matters enormously for anyone sharing a notebook as a readable report rather than just a scratch workspace, since well-placed Markdown cells turn a wall of code into something with genuine explanatory structure. Copying a cell (C) and pasting it (V, in Command mode) uses Jupyter's own internal clipboard, kept separate from your operating system's regular clipboard — worth knowing since a cell copied with C won't show up if you try pasting into a different application entirely, and text copied from outside Jupyter won't paste as a whole cell using Command-mode V the way an internally copied cell will. Extending selection to multiple cells (Shift+J to extend downward, Shift+K to extend upward) builds a multi-cell selection from whichever cell was originally selected, letting several subsequent Command-mode actions — delete, copy, or specifically merge — act on the whole selected block simultaneously rather than one cell at a time. Merging selected cells (Shift+M) combines a multi-cell selection (built with Shift+J/K first) into a single cell, concatenating their content in order — genuinely useful during the messier, exploratory phase of notebook work, when a train of thought that was originally split across several small experimental cells benefits from being consolidated into fewer, cleaner cells once you've settled on what's actually worth keeping. Undoing a cell operation (Z) reverts the most recent structural change — restoring an accidentally deleted cell being the single most common reason to reach for this — and it's worth being precise about the distinction from Ctrl+Z used while actively typing inside a cell in Edit mode, which instead undoes ordinary text-editing changes to that cell's own content. These are genuinely two separate undo histories: one tracks the notebook's cell structure, the other tracks text edits within a specific cell, and confusing which one you need is a common early point of friction. Moving a cell (Ctrl+Shift+Up/Down, or the toolbar's arrow icons) relocates the selected cell earlier or later in the notebook's overall order without needing to manually cut its content, delete the original cell, and paste the content into a newly created cell at the target position — a genuinely faster reordering workflow once a notebook has grown long enough that manual cut-and-paste reordering becomes tedious.