MATLAB Keyboard Shortcut Keys: Complete List (With Functions Explained)

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 + EnterCommand + Enterrun the section of code the cursor is in
F5F5 or Command + Option + Rrun the whole script or function
Ctrl + RCommand + /comment out the selected lines of code
Ctrl + F6Command + F6move forward through the MATLAB desktop tools
Ctrl + /Command + /show a compact list of keyboard shortcuts
Ctrl + GCommand + Ljump to a line number you type
Ctrl + FCommand + Ffind text in the current file or Command Window
Ctrl + CCommand + .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 + F6Command + F6 / Command + Shift + F6move forward and backward through the desktop
Ctrl + Tab / Ctrl + Shift + TabCommand + Tab / Command + Shift + Tabmove forward and backward, installed MATLAB only
TabTabmove into the current toolstrip tab
Up / Down / Left / RightUp / Down / Left / Rightmove between tabs or items in a tool
Ctrl + Page Up / Ctrl + Page DownCommand + Page Up / Command + Page Downmove between Editor, Live Editor and figure groups
DeleteDeleteclose documents in the Editor and Live Editor
Ctrl + 0 / Ctrl + 1 / Ctrl + 2 / Ctrl + 3Command + 0 / Command + 1 / Command + 2 / Command + 3Command Window (0), Command History (1), Files panel (2), Workspace panel (3)
Ctrl + Shift + 0 / Ctrl + Shift + 1 / Ctrl + Shift + 3Command + Shift + 0 / Command + Shift + 1 / Command + Shift + 3Editor (0), Figures (1), Variables editor (3)
Ctrl + Shift + MCommand + Shift + Menlarge the active tool or restore it
Shift + TabShift + Tabmove between the prompt and the scroll buffer
Ctrl + EnterCommand + Enteropen the link at the cursor
Shift + F10Shift + F10open the right-click menu
AltNo shortcutshow the letter keys for the toolstrip (not on macOS)
Alt + characterNo shortcutopen a tab by its letter, e.g. Alt+H for Home (not on macOS)
Ctrl + Shift + SpaceCommand + Shift + Spaceopen MATLAB search
Ctrl + ,Command + ,open MATLAB Settings
EscEscclose 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
TabTabstep into the axes of the selected figure
Shift + TabShift + Tabmove 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
EnterReturnrun the statement at the prompt
Shift + EnterShift + Returntype statements on several lines before running them
Up / DownUp / Downmove through the commands you ran before
EscEscclear a statement without running it
F9F9run 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 + FCommand + Fsearch for text in the Command Window
F3 / Shift + F3Command + G / Command + Shift + Gmove to the next or previous match
Shift + TabShift + Tabmove the cursor to previous commands and output
TabTabreturn the cursor to the command prompt
Tab / Enter / RightTab / Return / Rightinsert the suggested name as you type
EscEscclose the suggestion list without inserting anything
Ctrl + CCommand + .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 + MCommand + Shift + Menlarge the Editor to fill the window
Ctrl + Shift + UCtrl + Shift + Uundock the Editor into its own window
Ctrl + Shift + DCtrl + Shift + Ddock the Editor back into the desktop
Ctrl + Shift + 0Command + Shift + 0move the focus into the Editor
Ctrl + NCommand + Nopen a new blank script
Ctrl + OCommand + Oopen an existing file
Ctrl + Shift + TCommand + Shift + Treopen the file you closed most recently
Ctrl + SCommand + Ssave the file open in the Editor
Ctrl + PCommand + Pprint the file open in the Editor
Ctrl + WCommand + Wclose the file open in the Editor
Ctrl + ZCommand + Zundo the last change
Ctrl + YCommand + Shift + Zredo 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 + GCommand + Ljump to a line number you type
Ctrl + F2Command + F2set or remove a bookmark on the current line
F2F2jump to the next bookmark in the file
Shift + F2Shift + F2jump to the previous bookmark in the file
Alt + LeftCtrl + Minus (-)go back to the previous location
Alt + RightCtrl + Shift + Minus (-)go forward to the next location
Alt + UpOption + Upjump to the previous use of the same variable
Alt + DownOption + Downjump to the next use of the same variable
Ctrl + HomeCommand + Upjump to the first line of the file
Ctrl + EndCommand + Downjump 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 + FCommand + Ffind text in the current file
F3Command + Gjump to the next match in the file
Shift + F3Command + Shift + Gjump to the previous match in the file
Alt + MNo shortcutsearch only for text with the exact case (no Mac key)
Alt + WNo shortcutsearch only for whole words (no Mac key)
Alt + XNo shortcutsearch with a regular expression (no Mac key)
Alt + SNo shortcutsearch only inside the selected text (no Mac key)
Ctrl + HCommand + Option + Ffind text and replace it
Alt + RNo shortcutreplace the current match (no Mac key)
Alt + ANo shortcutreplace every match in the file (no Mac key)
EscEscclose the Find and Replace dialog
Ctrl + F3Command + Esearch 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 + EnterOption + Enterinsert a text line in a live script
Ctrl + Alt + TCtrl + Option + Tset the line to normal text
Ctrl + Shift + 1Ctrl + Shift + 1set the line to a level 1 heading
Ctrl + Shift + 2Ctrl + Shift + 2set the line to a level 2 heading
Ctrl + Shift + 3Ctrl + Shift + 3set the line to a level 3 heading
Ctrl + Alt + LCtrl + Option + Lset the line to title text
Ctrl + BCommand + Bmake the selected text bold
Ctrl + ICommand + Imake the selected text italic
Ctrl + UCommand + Uunderline the selected text
Ctrl + MCtrl + Mmake the selected text monospaced
Ctrl + Alt + UCtrl + Option + Umake the text a bulleted list
Ctrl + Alt + OCtrl + Option + Omake the text a numbered list
Ctrl + KCommand + Kinsert a hyperlink in the text
Ctrl + Shift + ECommand + Shift + Einsert an equation in the text
Ctrl + Shift + LCommand + Shift + Linsert 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 + RCommand + /comment out the selected lines
Ctrl + Shift + RCommand + Option + /remove the comment from the selected lines
Ctrl + JCommand + Shift + Wwrap the comments in the selected lines
Ctrl + ICommand + Iindent 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 + LCommand + Ccopy the whole line at the cursor
Ctrl + XCommand + Xcut the whole line at the cursor
Ctrl + Shift + CCommand + Shift + Ccopy the line and paste it below
Ctrl + Shift + ACommand + Shift + Achange the case of the selected text
Alt + EnterOption + Enterinsert a code line, or convert a line between code and text
Ctrl + Shift + OCommand + Option + Omove between code and output in a live script
Ctrl + MCommand + Mopen 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 + EnterCommand + Option + Enterinsert a section break at the cursor
Ctrl + EnterCommand + Enterrun the section the cursor is in
Ctrl + Shift + EnterCommand + Shift + Enterrun the section and move to the next one
Ctrl + UpCommand + Upjump to the previous section in the file
Ctrl + DownCommand + Downjump 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
F5F5 or Command + Option + Rrun the whole script or function
Ctrl + F5Command + F5pause the file while it runs
F5F5 or Command + Option + Rcontinue running a paused file
F12F12 or Command + \set or remove a breakpoint on the current line
F10F10 or Command + Shift + Orun the next line of code while debugging
F11F11 or Command + Shift + Istep into the function called on the current line
Shift + F11Shift + F11 or Command + Shift + Urun the rest of the function and step out of it
Shift + F5Shift + F5stop 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 + F11Command + F11show 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 + 0Command + Option + 0reset the zoom level to normal
Ctrl + Shift + KCommand + Shift + Kshow 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 + F7Option + F7jump to the next spelling issue
Alt + Shift + F7Option + Shift + F7jump 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.

Post a Comment

0 Comments