To split a cell in Jupyter Notebook, place the cursor where you want the break and press Ctrl+Shift+- while editing the cell. Jupyter creates two cells at that point; the shortcut works in the classic Notebook and is also commonly used in JupyterLab, though the exact binding can depend on your version and keymap.
Shortcut and what it does
The split-cell shortcut divides the selected cell’s contents at the text cursor. Everything before the cursor stays in the first cell, and everything after it moves into a new cell below. It does not split the notebook window or divide a cell into columns: it changes one cell into two consecutive notebook cells.
The key at the end of the shortcut is the minus or hyphen key, not a long dash. On many keyboards, holding Shift while pressing that key types an underscore. You should still use the physical minus key with the required modifiers; Jupyter recognizes the key combination rather than asking you to type a punctuation character into the cell.
The shortcut is useful when a cell has become too long or contains two distinct tasks. For instance, you might separate data loading from a chart, or put an explanation in its own Markdown cell. The split point is exactly where the cursor sits, so it is worth positioning the cursor carefully before invoking the command.
How to split a cell step by step
- Click inside the cell you want to divide, or select it and enter edit mode.
- Click or use the arrow keys to place the text cursor at the boundary between the content you want in the first cell and the content you want in the second.
- Press Ctrl+Shift+-.
- Check the two resulting cells. Edit their contents if needed, then run code cells in the order required by your notebook.
For example, if a code cell contains values = [2, 4, 6] on its first line and print(sum(values)) on its second, put the cursor at the start of the second line and split. The assignment remains in the first cell and the print statement moves to the second. The second cell can use values only after the first cell has been run in the current kernel session.
You can also access the same action from a menu. In classic Notebook, look for Edit > Split Cell at Cursor. In JupyterLab and Notebook 7, menu labels can vary slightly, but the action is available as a split-cell command. Menus are a helpful fallback if you cannot remember the shortcut or want to confirm which action it performs.
Command mode and edit mode
Jupyter notebooks use two keyboard modes, and the distinction explains many reports that a shortcut does nothing. In edit mode, a cell has a text cursor and usually shows a green outline in the classic interface. You can type or move through the cell’s source. The split action needs a cursor position, so it is intended to be used in edit mode.
In command mode, the cell is selected as a whole and usually has a blue outline in classic Notebook. Keystrokes in this mode act on the notebook rather than inserting text. Press Enter to enter edit mode for the selected cell; press Esc to return to command mode. If the split shortcut appears ineffective, first check that you can see a cursor inside the cell and that the cursor is at the intended location.
Mode colors and visual cues can differ between interfaces or themes. The practical test is simple: if typing a letter would insert it into the cell, you are editing; if keyboard input would select or operate on cells, you are likely in command mode.
Classic Notebook, Notebook 7, and JupyterLab
Classic Jupyter Notebook and JupyterLab share many familiar notebook actions, including splitting a cell at the cursor, but their interfaces and shortcut configuration screens are not identical. Notebook 7 is built on JupyterLab components, so it can look and behave more like JupyterLab than the older classic interface. A shortcut remembered from an older installation may therefore need checking rather than assuming it is universal.
In classic Notebook, the Edit menu provides a direct way to find the split command, and the Help menu includes keyboard-shortcut information. In JupyterLab, you can search for the split-cell command in the command palette or inspect the keyboard shortcuts in the Settings Editor. Those options let you confirm the binding configured in the running application, which is more reliable than a generic shortcut list when extensions or custom settings are involved.
If a menu command works but the keystroke does not, the cell operation itself is available; the issue is likely the active keymap, focus, or a shortcut conflict. Use the menu or command palette while you check the configured binding.
What happens to code, Markdown, and output
For a code cell, splitting changes how source code is grouped; it does not run either piece. A useful split is often between complete statements or logical sections. Splitting in the middle of a string, expression, indentation block, or multi-line function definition can leave one or both cells syntactically invalid. Python allows some expressions to span lines, but the split still has to leave valid code in each cell if you intend to run them separately.
For a Markdown cell, the text is divided at the cursor and each resulting cell is rendered as Markdown when you run it. A split can be helpful for separating a heading from the paragraph that follows, but consider whether formatting depends on nearby lines. For example, splitting a numbered list or a fenced code block can change how the pieces render. If the result looks wrong, edit the Markdown boundaries or join the cells again.
Splitting is an editing operation, not a recalculation. If the original code cell had output, do not assume that output now describes the contents of both new cells. After changing the code, run the relevant cells and inspect the results. In particular, the second cell may depend on variables created by the first, so running it alone can produce a name error if those variables are not in the kernel.
Keyboard layouts and shortcut conflicts
The default shortcut is commonly shown as Ctrl+Shift+- on Windows and Linux. On macOS, the binding can depend on the Jupyter version and configured keymap; do not assume that replacing Ctrl with Command is always correct. Check the shortcut displayed by your installation. Some custom keymaps or extensions may assign a different combination.
Keyboard layouts can also make the final key confusing. The key may be labelled with a hyphen, minus, or underscore, and producing an underscore normally requires Shift. Follow the combination shown in Jupyter’s shortcut help rather than trying to type a dash into the cell. If the browser or operating system captures the keystroke, click the cell first and use the menu command as a reliable alternative.
In JupyterLab, use the Settings Editor’s keyboard-shortcut settings to review or change a binding. In classic Notebook, consult Help > Keyboard Shortcuts. If you change a binding, check for a conflict with another command and make a note of the new combination so it is easy to find later.
When splitting helps—and when another edit is better
Splitting is most useful when the material naturally forms separate steps. A cell that imports data, cleans it, calculates a result, and draws a chart may be easier to understand as a sequence of smaller cells. It can also help readers run one stage at a time, inspect intermediate values, or distinguish explanatory Markdown from executable code.
Smaller cells are not automatically better. A single short expression may be clearer left together, and breaking a tightly connected operation into many pieces can make execution order harder to follow. Before splitting, ask whether each resulting cell has a clear purpose and whether a reader can run the notebook from top to bottom without relying on hidden state.
- Split between distinct tasks, such as loading data and plotting it.
- Keep code together when its lines form one small, cohesive operation.
- Use a Markdown cell when the goal is to add an explanation rather than execute code.
- After reorganizing, test the sequence from a clean or restarted kernel if reproducibility matters.
Joining cells and other alternatives
If you split at the wrong place, you can usually undo the edit with Ctrl+Z immediately, or join the cells again using the notebook’s merge-cells command. In classic Notebook, joining selected cells is available from the Edit menu; JupyterLab also provides a merge-cells action. The exact shortcut for merging is separate from the split shortcut and can vary by interface, so check the relevant menu or shortcut list rather than guessing.
If you only need to move a few lines, ordinary cut and paste can be more precise: select the lines, cut them, and paste them into a new cell. To create a blank cell without dividing existing content, use the insert-cell command instead. These are different operations: splitting preserves both sides of the original content, while inserting creates an empty cell and moving text requires a separate edit.
Common problems and quick fixes
- Nothing happens: enter edit mode, put the cursor inside the cell, and check the shortcut listed by your Jupyter interface.
- The browser reacts instead: click the cell to give the notebook focus, then try the menu command or check for a keybinding conflict.
- The split is in the wrong place: undo immediately or move the content between cells manually, then split at the intended cursor position.
- The second code cell errors: run the earlier cell that defines its variables, or restart and run the notebook in order to verify dependencies.
- Markdown formatting changes: inspect headings, lists, and code fences in both cells; a formatting construct may have been divided across the boundary.
Frequently Asked Questions
What is the shortcut to split a cell in Jupyter Notebook?
Place the cursor in the cell and use Ctrl+Shift+-. Check the shortcut help in your own installation if it has a different keymap.
Do I need to be in edit mode to split a cell?
Yes, the command splits at the text cursor, so enter edit mode and position the cursor where you want the boundary. In command mode, the cell is selected but there is no insertion point to split at.
Does splitting a cell run the code?
No. It divides the cell’s source but does not execute it. Run the resulting code cells as needed, in an order that satisfies their variable dependencies.
Does the JupyterLab shortcut differ from classic Notebook?
The split-cell action exists in both, and the familiar default is often the same. However, versions, keymaps, and extensions can change bindings, so use the command palette or shortcut settings to verify yours.
How do I split a cell on a Mac?
Check the binding shown in the shortcut help for your Jupyter version and keymap. Some installations retain the Ctrl-based combination, while a customized keymap may use Command; the displayed binding is the dependable reference.
Related
- Excel Text to Columns: Split Cells at Line Breaks Easily
- Excel Text to Columns by Word: Methods That Work
- Excel Text to Columns: How to Keep Leading Zeros Safely
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Google Sheets Filter Only for Me? Use Filter ViewsYes. In Google Sheets, use a filter view when you want to sort or filter rows without changing…
- Excel: Group Rows by the Same ValueYes. In Excel for Microsoft 365 on Windows, sort your records by the value you want to group,…
- Unable to Create Rules in New Outlook? Fixes That WorkYes, you can create email rules in new Outlook, but the option may be missing or unavailable because…
- Excel Dropdown List Dynamic Range: Setup and FixesTo make an Excel dropdown list use a dynamic range, store its choices in an Excel Table and…
- Unmerge Cells in Google Sheets: Shortcut and StepsGoogle Sheets has no dedicated one-keystroke shortcut for unmerging cells. In a browser, open the Tool finder with…
- Remove Formatting Marks in Word: Show or Hide ThemTo remove formatting marks from view in Word, press Ctrl+Shift+8 on Windows or Command+8 on Mac, or select…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.