How to Delete a Cell in Jupyter Notebook (D, D)
Windows: D, D (press twice)
Mac: D, D
Linux: D, D
Pressing D twice in quick succession while in Command mode (blue-bordered selected cell) deletes that cell entirely, including its code or Markdown content and any output it had produced from previous execution.
**Why the double-tap specifically**: this is a deliberate safety feature, not an arbitrary quirk. A single D press does nothing on its own — Jupyter waits briefly to see if a second D follows before actually committing to the delete. This exists specifically because Command mode's other single-letter shortcuts fire instantly with no confirmation at all, and cell deletion is destructive enough (losing written code, however briefly, before Undo could recover it) that Jupyter's designers chose to require a deliberate two-key sequence rather than one accidental keystroke.
**Getting into the right mode first**: this shortcut only works in Command mode. If you're actively typing inside a cell (Edit mode, green border), pressing D twice simply types the letter D twice into your code or text — press Esc first to return to Command mode if you're not certain which mode you're currently in, since the visual border color is the quickest way to confirm.
**Recovering from an accidental delete**: pressing Z (also in Command mode) immediately after a deletion restores the cell exactly as it was, content and output both — this is genuinely the single most common reason anyone reaches for the Z undo shortcut, and it's worth knowing it works reliably as long as you catch the mistake reasonably soon rather than continuing to work for a while afterward, since Jupyter's cell-operation undo history has practical limits on how far back it retains.
**Deleting multiple cells at once**: extending your selection to several adjacent cells first (with Shift+J or Shift+K, covered on the command-mode category page) and then pressing D, D deletes the entire selected range in one action, rather than needing to repeat the double-tap once per individual cell — genuinely faster for cleaning up a stretch of several cells that are all no longer needed.
**What happens to cell numbering after a delete**: Jupyter's execution-count numbers (the bracketed number next to each code cell showing the order it was run in) aren't automatically renumbered or otherwise affected by deleting a different cell — those numbers simply reflect each remaining cell's own most recent run order, which can produce a visually non-sequential set of numbers after deletions and reruns, a normal and expected state rather than a sign anything is broken.
**Related shortcuts**: A and B (covered on the command-mode category page) insert new cells above or below, the natural opposite operations to deleting — a common editing pattern is deleting a cell that's no longer needed and immediately inserting a fresh one with B to replace it with something new, rather than trying to repurpose the deleted cell's old content.
**Mistake to avoid**: pressing D once and then, moments later, pressing D again for an unrelated reason (perhaps having moved to a different cell in between) can accidentally trigger a delete if the two presses land close enough together in time for Jupyter to interpret them as the intended double-tap — this is a genuinely rare edge case, but it's worth being aware that the double-tap window isn't scoped strictly to "the same cell you started on," just to timing between the two keypresses.