MATLAB is the programming and numeric computing platform from MathWorks, used by engineers and scientists for matrix calculations, data analysis, plotting, simulations and algorithm development. Most MATLAB work happens in two places: the Command Window, where you type commands and see results at once, and the Editor, where you write scripts, live scripts and functions.
This complete list explains every shortcut in plain words, so you know not just which keys to press but what each one actually does. Every shortcut here was checked against MathWorks official documentation. Windows and Linux share the same keys for almost every command, while macOS has its own keys, so this post gives both. The current release is MATLAB R2026b, released on 24 September 2026.
How to Use MATLAB Shortcuts
Three shortcuts unlock almost everything in MATLAB. Press Control plus Enter in the Editor to run the current section of your script, the key you will press more than any other. Press Control plus F6 to move between the areas of the MATLAB desktop — the Command Window, the Editor, the Workspace and the Files panel — without touching the mouse. Press Control plus forward slash to show a compact list of all keyboard shortcuts.
Second, the same key can mean different things in different tools. In the Editor, Control plus Enter runs a section, but in the Command Window it opens the link at the cursor. In a live script, Control plus I makes text italic, but in code it smart-indents the line. Third, the F keys run and debug your code: F5 runs the file, F12 sets a breakpoint, F10 steps one line, F11 steps into a function, and Shift plus F5 quits execution.
Top MATLAB Shortcuts
These are the shortcuts MATLAB users reach for most often.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + Enter | Command + Enter | run the section of code the cursor is in |
| F5 | F5 or Command + Option + R | run the whole script or function |
| Ctrl + R | Command + / | comment out the selected lines of code |
| Ctrl + F6 | Command + F6 | move forward through the MATLAB desktop tools |
| Ctrl + / | Command + / | show a compact list of keyboard shortcuts |
| Ctrl + G | Command + L | jump to a line number you type |
| Ctrl + F | Command + F | find text in the current file or Command Window |
| Ctrl + C | Command + . | stop the code that is currently running |
Desktop Navigation Shortcuts
Desktop shortcuts move you around MATLAB without a mouse. Control plus F6 steps forward through the toolstrip, the Current Folder toolbar, the sidebar panels and the Command Window, and Control plus Shift plus F6 steps back. The tool-focus keys and Control plus Page Up and Page Down do not work in MATLAB Online, and the Alt access keys do not work on a Mac.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + F6 / Ctrl + Shift + F6 | Command + F6 / Command + Shift + F6 | move forward and backward through the desktop |
| Ctrl + Tab / Ctrl + Shift + Tab | Command + Tab / Command + Shift + Tab | move forward and backward, installed MATLAB only |
| Tab | Tab | move into the current toolstrip tab |
| Up / Down / Left / Right | Up / Down / Left / Right | move between tabs or items in a tool |
| Ctrl + Page Up / Ctrl + Page Down | Command + Page Up / Command + Page Down | move between Editor, Live Editor and figure groups |
| Delete | Delete | close documents in the Editor and Live Editor |
| Ctrl + 0 / Ctrl + 1 / Ctrl + 2 / Ctrl + 3 | Command + 0 / Command + 1 / Command + 2 / Command + 3 | Command Window (0), Command History (1), Files panel (2), Workspace panel (3) |
| Ctrl + Shift + 0 / Ctrl + Shift + 1 / Ctrl + Shift + 3 | Command + Shift + 0 / Command + Shift + 1 / Command + Shift + 3 | Editor (0), Figures (1), Variables editor (3) |
| Ctrl + Shift + M | Command + Shift + M | enlarge the active tool or restore it |
| Shift + Tab | Shift + Tab | move between the prompt and the scroll buffer |
| Ctrl + Enter | Command + Enter | open the link at the cursor |
| Shift + F10 | Shift + F10 | open the right-click menu |
| Alt | No shortcut | show the letter keys for the toolstrip (not on macOS) |
| Alt + character | No shortcut | open a tab by its letter, e.g. Alt+H for Home (not on macOS) |
| Ctrl + Shift + Space | Command + Shift + Space | open MATLAB search |
| Ctrl + , | Command + , | open MATLAB Settings |
| Esc | Esc | close an open menu or the Command History pop-up |
Figure Navigation Shortcuts
Figure shortcuts explore plotted data with the keyboard. Once a figure is selected, Tab steps into the axes, and if a figure has more than one axes, Tab steps to the next one.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Tab | Tab | step into the axes of the selected figure |
| Shift + Tab | Shift + Tab | move through the axes in the reverse order |
Command Window Shortcuts
Command Window shortcuts run commands and recall them. Press the Up arrow to recall the last command, and type part of a command first and then press Up to recall a matching one. Shift plus Enter lets you type a statement on more than one line before MATLAB runs it. Since R2026b you can also activate enhanced output from the keyboard.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Enter | Return | run the statement at the prompt |
| Shift + Enter | Shift + Return | type statements on several lines before running them |
| Up / Down | Up / Down | move through the commands you ran before |
| Esc | Esc | clear a statement without running it |
| F9 | F9 | run a statement already shown in the window |
| Enter (on a selection) | Return (on a selection) | run only the selected code at the command line |
| Ctrl + F | Command + F | search for text in the Command Window |
| F3 / Shift + F3 | Command + G / Command + Shift + G | move to the next or previous match |
| Shift + Tab | Shift + Tab | move the cursor to previous commands and output |
| Tab | Tab | return the cursor to the command prompt |
| Tab / Enter / Right | Tab / Return / Right | insert the suggested name as you type |
| Esc | Esc | close the suggestion list without inserting anything |
| Ctrl + C | Command + . | stop the code that is currently running |
Editor General and File Shortcuts
Editor general shortcuts dock, undock and maximize the Editor, and file shortcuts open, save, print and close your scripts. Control plus Shift plus T reopens the last file you closed.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + Shift + M | Command + Shift + M | enlarge the Editor to fill the window |
| Ctrl + Shift + U | Ctrl + Shift + U | undock the Editor into its own window |
| Ctrl + Shift + D | Ctrl + Shift + D | dock the Editor back into the desktop |
| Ctrl + Shift + 0 | Command + Shift + 0 | move the focus into the Editor |
| Ctrl + N | Command + N | open a new blank script |
| Ctrl + O | Command + O | open an existing file |
| Ctrl + Shift + T | Command + Shift + T | reopen the file you closed most recently |
| Ctrl + S | Command + S | save the file open in the Editor |
| Ctrl + P | Command + P | print the file open in the Editor |
| Ctrl + W | Command + W | close the file open in the Editor |
| Ctrl + Z | Command + Z | undo the last change |
| Ctrl + Y | Command + Shift + Z | redo a change you undid |
Editor Navigation Shortcuts
Navigation shortcuts jump around a file. Control plus G jumps to a line number, F2 walks through bookmarks, and Alt plus Up or Down jumps to the previous or next place the same variable is used. On a Mac, Go to previous section and Go to beginning of file are both listed as Command plus Up in the official docs, and Go to next section and Go to end of file are both listed as Command plus Down.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + G | Command + L | jump to a line number you type |
| Ctrl + F2 | Command + F2 | set or remove a bookmark on the current line |
| F2 | F2 | jump to the next bookmark in the file |
| Shift + F2 | Shift + F2 | jump to the previous bookmark in the file |
| Alt + Left | Ctrl + Minus (-) | go back to the previous location |
| Alt + Right | Ctrl + Shift + Minus (-) | go forward to the next location |
| Alt + Up | Option + Up | jump to the previous use of the same variable |
| Alt + Down | Option + Down | jump to the next use of the same variable |
| Ctrl + Home | Command + Up | jump to the first line of the file |
| Ctrl + End | Command + Down | jump to the last line of the file |
Find and Replace Shortcuts
Find shortcuts search inside one file. Six of these options have no key on a Mac at all: Match case, Match whole word, Search using regular expression, Find in selection, Replace and Replace all are all marked N/A for macOS in the official docs.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + F | Command + F | find text in the current file |
| F3 | Command + G | jump to the next match in the file |
| Shift + F3 | Command + Shift + G | jump to the previous match in the file |
| Alt + M | No shortcut | search only for text with the exact case (no Mac key) |
| Alt + W | No shortcut | search only for whole words (no Mac key) |
| Alt + X | No shortcut | search with a regular expression (no Mac key) |
| Alt + S | No shortcut | search only inside the selected text (no Mac key) |
| Ctrl + H | Command + Option + F | find text and replace it |
| Alt + R | No shortcut | replace the current match (no Mac key) |
| Alt + A | No shortcut | replace every match in the file (no Mac key) |
| Esc | Esc | close the Find and Replace dialog |
| Ctrl + F3 | Command + E | search for the currently selected text |
Live Script Text Shortcuts
Text shortcuts work in live scripts and live functions only, where you mix formatted text with code. Control plus Shift plus 1, 2 or 3 makes a heading, Control plus Alt plus L makes a title, and Control plus B, I and U make text bold, italic and underlined. Control plus I is Italic here but Smart indent in code, and Control plus M is Monospaced text here but opens a Code Analyzer message in code.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Alt + Enter | Option + Enter | insert a text line in a live script |
| Ctrl + Alt + T | Ctrl + Option + T | set the line to normal text |
| Ctrl + Shift + 1 | Ctrl + Shift + 1 | set the line to a level 1 heading |
| Ctrl + Shift + 2 | Ctrl + Shift + 2 | set the line to a level 2 heading |
| Ctrl + Shift + 3 | Ctrl + Shift + 3 | set the line to a level 3 heading |
| Ctrl + Alt + L | Ctrl + Option + L | set the line to title text |
| Ctrl + B | Command + B | make the selected text bold |
| Ctrl + I | Command + I | make the selected text italic |
| Ctrl + U | Command + U | underline the selected text |
| Ctrl + M | Ctrl + M | make the selected text monospaced |
| Ctrl + Alt + U | Ctrl + Option + U | make the text a bulleted list |
| Ctrl + Alt + O | Ctrl + Option + O | make the text a numbered list |
| Ctrl + K | Command + K | insert a hyperlink in the text |
| Ctrl + Shift + E | Command + Shift + E | insert an equation in the text |
| Ctrl + Shift + L | Command + Shift + L | insert a LaTeX equation in the text |
Code Shortcuts
Code shortcuts comment, indent and reshape your code. Control plus R comments the selected lines and Control plus Shift plus R uncomments them, the fastest way to switch a block of code off and on while you test. Note the Copy Line quirk: it is Control plus L on Windows and Linux, but Command plus C on a Mac, the same key as Copy.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + R | Command + / | comment out the selected lines |
| Ctrl + Shift + R | Command + Option + / | remove the comment from the selected lines |
| Ctrl + J | Command + Shift + W | wrap the comments in the selected lines |
| Ctrl + I | Command + I | indent the code to match its structure |
| Ctrl + ] | Command + ] | move the selected lines one indent to the right |
| Ctrl + [ | Command + [ | move the selected lines one indent to the left |
| Ctrl + L | Command + C | copy the whole line at the cursor |
| Ctrl + X | Command + X | cut the whole line at the cursor |
| Ctrl + Shift + C | Command + Shift + C | copy the line and paste it below |
| Ctrl + Shift + A | Command + Shift + A | change the case of the selected text |
| Alt + Enter | Option + Enter | insert a code line, or convert a line between code and text |
| Ctrl + Shift + O | Command + Option + O | move between code and output in a live script |
| Ctrl + M | Command + M | open the Code Analyzer message or expand its details |
Section Shortcuts
Section shortcuts split a script into sections with double percent signs, so you can run one part at a time. Control plus Alt plus Enter inserts a section break, Control plus Enter runs the current section, and Control plus Shift plus Enter runs it and moves to the next one.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + Alt + Enter | Command + Option + Enter | insert a section break at the cursor |
| Ctrl + Enter | Command + Enter | run the section the cursor is in |
| Ctrl + Shift + Enter | Command + Shift + Enter | run the section and move to the next one |
| Ctrl + Up | Command + Up | jump to the previous section in the file |
| Ctrl + Down | Command + Down | jump to the next section in the file |
Run and Debug Shortcuts
Run and debug shortcuts work the same on every platform. F5 runs the file, F12 sets or clears a breakpoint on the current line, F10 runs the next line, F11 steps into a function, Shift plus F11 steps out of it, and Shift plus F5 quits execution. On a Mac, most of these also have a Command-key alternative.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| F5 | F5 or Command + Option + R | run the whole script or function |
| Ctrl + F5 | Command + F5 | pause the file while it runs |
| F5 | F5 or Command + Option + R | continue running a paused file |
| F12 | F12 or Command + \ | set or remove a breakpoint on the current line |
| F10 | F10 or Command + Shift + O | run the next line of code while debugging |
| F11 | F11 or Command + Shift + I | step into the function called on the current line |
| Shift + F11 | Shift + F11 or Command + Shift + U | run the rest of the function and step out of it |
| Shift + F5 | Shift + F5 | stop the debugging session |
Display, Folding and Spelling Shortcuts
Display shortcuts zoom the Editor and show it full screen. Folding shortcuts collapse blocks of code into one line so you can hide the parts you are not working on, and spelling shortcuts walk through spelling issues in your comments and text.
| Shortcut (Windows/Linux) | Shortcut (macOS) | Function |
|---|---|---|
| Ctrl + F11 | Command + F11 | show the Editor full screen |
| Ctrl + Plus (+) or Ctrl + = | Command + Plus (+) or Command + = | enlarge the text in the Editor |
| Ctrl + Minus (-) | Command + Minus (-) | shrink the text in the Editor |
| Ctrl + Alt + 0 | Command + Option + 0 | reset the zoom level to normal |
| Ctrl + Shift + K | Command + Shift + K | show or hide the Markdown preview |
| Ctrl + Shift + Period (.) | Ctrl + Shift + Period (.) | expand the folded code at the cursor |
| Ctrl + Period (.) | Ctrl + Period (.) | collapse the code at the cursor into one line |
| Ctrl + Shift + Comma (,) | Ctrl + Shift + Comma (,) | expand every folded block in the file |
| Ctrl + Comma (,) | Ctrl + Comma (,) | collapse every foldable block in the file |
| Alt + F7 | Option + F7 | jump to the next spelling issue |
| Alt + Shift + F7 | Option + Shift + F7 | jump to the previous spelling issue |
How to Create Custom Shortcuts in MATLAB
Almost every shortcut in MATLAB can be changed, and you can assign a shortcut to an action that has none. On the Home tab, in the Environment section, click Settings, then open the Keyboard Shortcuts page. Type the name of an action in the search box — for example, type clear to find the shortcut for clearing selected text, which is the Escape key. Click the Add shortcut button in the Shortcuts column, then press the keys you want. To enter a special key such as Tab or Escape, click the Add special keys button. If you tick Allow multi-stroke shortcuts, you can give an action up to two keystrokes, for example Control plus Y followed by Shift plus Z. If the shortcut is already used by another action, the dialog shows the conflict, so you can pick another one. To change a shortcut, double-click it and press the new keys. To delete one, click the Delete shortcut button next to it. To restore the defaults for one action, select it and click Restore defaults; to restore all of them, click the settings button at the top right of the page. Some shortcuts cannot be customized and do not appear in the search, including cancelling the current action with Escape, interrupting execution with Control plus C, and some navigation shortcuts. You can also switch the whole shortcut set at the top of the page, or save your own set as a JSON file and compare two sets side by side.
Tips for MATLAB Users
Learn shortcuts in small groups, starting with the five that save the most time every day: Control plus Enter to run a section, F5 to run the whole file, Control plus R to comment a line, Control plus F6 to move between the desktop tools, and Control plus G to jump to a line. Use those five for a week, then add Control plus Shift plus T to reopen a closed file, Control plus Shift plus R to uncomment, F12 for breakpoints, and Control plus Shift plus M to maximize the Editor. When a shortcut seems dead, check whether the right tool has the focus, because keys such as Control plus Enter mean different things in the Editor and in the Command Window, and whether you are in a live script, because the text shortcuts only work there. In MATLAB Online, the tool-focus keys and Control plus Page Up and Page Down do not work. On a Mac, the Alt toolstrip keys do not exist, and six Find options have no Mac key, so use the Find dialog buttons for those instead.
Frequently Asked Questions
What is the latest version of MATLAB?
The current version is MATLAB R2026b, released on 24 September 2026. It follows R2026a from April 2026, and the next release, R2027a, is not out yet. Every shortcut in this post was verified against the MathWorks official documentation for R2026b.
What is the shortcut to run code in MATLAB?
Press Control plus Enter on Windows and Linux, or Command plus Return on a Mac, to run the current section of your script. Press F5 to run the whole file, or Command plus Option plus R on a Mac. While debugging, F5 continues a paused file.
How do I comment out code in MATLAB?
Press Control plus R on Windows and Linux, or Command plus forward slash on a Mac, to comment out the selected lines. Press Control plus Shift plus R, or Command plus Option plus forward slash on a Mac, to uncomment them again.
How do I stop a MATLAB program that is running?
Press Control plus C on Windows and Linux, or Command plus period on a Mac, to interrupt execution. On Windows and Linux you can also press Control plus Break. While debugging, press Shift plus F5 to quit execution.
How do I move between the Command Window and the Editor in MATLAB?
Press Control plus F6 to move forward through the areas of the MATLAB desktop, or Control plus Shift plus F6 to move back. On a Mac, use Command plus F6 and Command plus Shift plus F6. You can also jump straight to a tool: Control plus 0 opens the Command Window and Control plus Shift plus 0 makes the Editor active, with Command instead of Control on a Mac.
Can I change keyboard shortcuts in MATLAB?
Yes. On the Home tab, in the Environment section, click Settings, then open the Keyboard Shortcuts page. Search for the action, click Add shortcut, and press the keys you want. MATLAB warns you if the shortcut is already used by another action. Some shortcuts cannot be changed, such as Escape to cancel and Control plus C to interrupt.
Why are my MATLAB shortcuts not working?
The most common causes are the wrong tool having the focus, because keys such as Control plus Enter mean different things in the Editor and in the Command Window, and working in MATLAB Online, where the tool-focus keys and Control plus Page Up and Page Down do not work. On a Mac, the Alt toolstrip access keys do not exist, and six Find options have no Mac key at all, so use the Find dialog buttons for those. A shortcut can also seem dead in a live script, where the text shortcuts only work, or in code, where Control plus I and Control plus M do different things than in text.
By Umar Farooq, Tech Know.


0 Comments