Jupyter Split Cell: How to Split a Cell in a Notebook

How-to basics · Updated November 5, 2026

Jupyter Split Cell: How to Split a Cell in a Notebook

To split a cell in Jupyter, enter edit mode, place the cursor where the new cell should begin, and press Ctrl+Shift+- (Control, Shift, and the minus key). The cell is divided at that point; you can also use Edit > Split Cell in the menu.

What splitting a cell does

A Jupyter notebook is made up of cells, and each cell can hold code, Markdown, or another supported cell type. Splitting turns one cell into two at the cursor position. The text before the cursor stays in the first cell, while the text after it moves into a new cell below. It does not merely insert a line break: it changes the notebook’s structure and, for code, creates two separately runnable units.

For example, suppose a code cell contains an import, a calculation, and a print statement. Splitting before the calculation gives you one cell for the import and another for the calculation and output. You can then run either cell independently, subject to the usual rule that required variables and imports must already exist in the kernel.

Splitting does not automatically make code logically independent. If the lower cell uses a variable created in the upper cell, it still depends on that earlier execution. The benefit is that you can organize, run, explain, and revise the pieces separately.

How to split a cell step by step

  1. Click inside the cell you want to divide. In edit mode, a text cursor appears in the cell. If the cell is selected but has no cursor, press Enter to enter edit mode.
  2. Move the cursor to the exact boundary between the content that should stay above and the content that should move below. You can click at the position or use the arrow keys.
  3. Press Ctrl+Shift+-. In Jupyter’s menus, the equivalent command is generally Edit > Split Cell.
  4. Review both resulting cells. Confirm that indentation, punctuation, Markdown formatting, and cell type still make sense, then run the code cells in the intended order if needed.

The cursor position matters more than the visual line. A split can happen in the middle of a line or even in the middle of a word. For a clean division, place it at the beginning of the statement, paragraph, or section you want to move to the lower cell.

Splitting a code cell

Consider this single cell:

subtotal = 12
shipping = 3
total = subtotal + shipping
print(total)

If you place the cursor before total = subtotal + shipping and split, the first cell contains the assignments to subtotal and shipping. The second contains the total calculation and print statement. This can make a notebook easier to read, especially when each cell represents a meaningful step in an analysis.

Take care not to split a statement at an arbitrary point. For example, dividing a line such as total = subtotal + shipping between the plus sign and shipping leaves incomplete code in both cells. Similarly, splitting a multi-line function definition may leave the first cell without its full body or move an indented line into a context where it is invalid. After splitting, inspect the code as Python will interpret it—not just how the lines look on screen.

A useful division is often between complete operations: importing libraries, loading data, cleaning a column, producing a plot, or writing a conclusion. Smaller cells are not automatically better, though. If a few lines form one coherent operation and are usually edited or run together, keeping them in one cell can be clearer.

Splitting a Markdown cell

The same basic action can divide a Markdown cell. Place the cursor between two sections, then use the split command. For example, you might separate a long explanation into a heading and its own paragraph, or put a description in one cell and a list in the next. Both cells remain Markdown cells in the usual notebook behavior.

Splitting does not add a heading or repair Markdown syntax for you. If you divide a paragraph in the middle of a sentence, each cell may render as an awkward fragment. If you split near Markdown markers such as **bold text**, a link, or a fenced code block, check that the opening and closing markers remain in the same cell where necessary. Markdown is parsed cell by cell, so a marker opened in one cell should not be expected to format text in the next.

To change a cell from code to Markdown or the other way around, use the cell-type control or the relevant menu command; splitting is not the same as changing a cell’s type. This distinction is helpful when a split creates the right structure but one of the resulting cells needs to be explanatory text rather than executable code.

Keyboard shortcut and menu differences

Ctrl+Shift+- is the commonly used split shortcut in Jupyter interfaces, but the exact keystroke can depend on the frontend, browser, operating system, keyboard layout, and any customized keymap. On some Mac setups, the displayed or configured shortcut may use Command rather than Ctrl; do not assume the modifier is identical across installations.

If the shortcut does nothing, use Edit > Split Cell from the notebook menu. This is also the easiest route when you are unsure whether the shortcut is configured or when another application or browser action intercepts the keys. JupyterLab and current Jupyter Notebook interfaces can differ in appearance, but their menu-based command is a useful fallback. If a menu is hidden or rearranged in a particular environment, look for Split Cell in that interface’s command search or help for keyboard shortcuts.

Be aware of the two editing states. In command mode, the cell is selected as a whole; in edit mode, the cursor is inside its contents. The shortcut needs a meaningful cursor position, so click in the text or press Enter before using it. Pressing Esc usually returns focus to command mode, where keys may instead trigger notebook navigation or other commands.

What happens to outputs and execution

A code cell’s displayed output is not a permanent proof that its current source is correct. Outputs can become stale whenever source code changes, and splitting changes the source and the number of cells. Depending on the notebook frontend and the state of the cell, existing output may remain associated with a cell or be cleared as the edit is applied. Either way, inspect the result rather than assuming the old output belongs to the new arrangement.

Run the resulting cells when you need output that matches the revised code. Use Run or the notebook’s usual execution shortcut, and pay attention to execution order. For instance, the lower cell in the subtotal example will fail if it runs before the cell that defines subtotal and shipping. A notebook can retain variables in its live kernel even after you reorganize cells, which may hide missing dependencies until you restart the kernel or run cells in a fresh order.

Splitting does not restart the kernel, erase every variable, or guarantee that the notebook is reproducible. If you are restructuring a notebook for someone else to run, consider testing it from a clean kernel in order from top to bottom. That reveals dependencies on earlier execution history that ordinary repeated runs may conceal.

Common problems and how to fix them

  • The shortcut does nothing: Confirm that the cursor is inside the cell and try Edit > Split Cell. Check the interface’s shortcut settings if you regularly use a customized keymap.
  • The split appears in the wrong place: Undo immediately if appropriate, then position the cursor more carefully. The command divides at the text cursor, not necessarily at the start of the line you have in mind.
  • The new code cell raises an error: Look for a cut-off statement, broken indentation, or a variable that is defined in another cell that has not been run. Splitting is a text-and-structure operation, not a code-aware refactoring tool.
  • Markdown renders oddly: Check whether a paragraph, list, link, emphasis marker, or fenced code block was divided across cells. Markdown formatting does not generally flow from one cell into the next.
  • The output looks inconsistent: Treat it as potentially outdated and rerun the relevant cells in order. Output reflects execution history, not necessarily the current source text.

If the result is not what you intended, undo can usually reverse a recent edit, but behavior may depend on the frontend and whether other actions have happened since. For important work, save the notebook before making broad structural changes. Also remember that splitting one cell does not necessarily split its narrative purpose: the two pieces should still make sense to a reader.

When to split—and when not to

Split a cell when a clear boundary will help with execution, explanation, or navigation. A data notebook might use separate cells to import packages, read a file, clean values, and create a chart. A teaching notebook might place a short explanation in Markdown immediately before the code that illustrates it. These divisions let a reader rerun a focused step without rerunning an entire long cell.

Keep a cell intact when its lines form one operation that is easier to understand together, or when splitting would create fragile dependencies or incomplete code. A function definition, a compact transformation, or a short block that must run as a unit may be clearer as one cell. The goal is not to maximize the number of cells; it is to make the notebook’s sequence and reasoning understandable.

Splitting is also different from inserting a new blank cell. Use Split Cell when existing content needs to be divided at the cursor. Use the notebook’s insert-cell command when you want an empty cell above or below the selected cell, without moving any of its text.

Frequently Asked Questions

What is the Jupyter shortcut to split a cell?
In many Jupyter setups, place the cursor in the cell and press Ctrl+Shift+-. If that shortcut is unavailable or behaves differently on your system, use Edit > Split Cell.

Can I split a Jupyter cell in the middle of a line?
Yes. The split happens at the cursor, including within a line. However, splitting inside a Python statement or Markdown construct can create invalid or confusing content, so choose a logical boundary where possible.

Does splitting a cell create two cells of the same type?
Normally, the new cell keeps the original cell type, so splitting code produces code cells and splitting Markdown produces Markdown cells. Check the type selector if your frontend behaves unexpectedly or if you want to change one afterward.

Will splitting a code cell erase its output?
There is not one safe assumption for every interface and edit state. Output may remain attached to a cell or be cleared, and any retained output may no longer match the source. Rerun the relevant cells to verify it.

Can I split a cell in JupyterLab?
Yes. Use the split shortcut supported by your keymap or choose Edit > Split Cell. The menu is the dependable option if your shortcut differs by platform or has been customized.

A practical rule of thumb

Place the cursor where a reader would naturally see a new step, split the cell, and then check the result as both text and executable notebook structure. The operation is simple, but a thoughtful boundary keeps code valid, Markdown readable, and cell outputs easier to interpret.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.