MATLAB keyboard shortcuts
MATLAB is MathWorks' language and desktop for numeric computing, used by engineers and scientists. These Editor keys open and save files, jump through code and bookmarks, comment and indent, run sections, fold code, and move focus around the desktop.
Windows, macOS, Linux · 82 shortcutsEditor windows and files
Arrange the Editor, open files, save work, and move between documents.
| Action | Shortcuts |
|---|---|
| Maximize or restore the Editor | Windows / LinuxCtrl + Shift + M macOSCmd + Shift + M |
| Undock the Editor | Windows / macOS / LinuxCtrl + Shift + U |
| Dock the Editor | Windows / macOS / LinuxCtrl + Shift + D |
| Activate the Editor | Windows / LinuxCtrl + Shift + 0 macOSCmd + Shift + 0 |
| Create a new file | Windows / LinuxCtrl + N macOSCmd + N |
| Open a file | Windows / LinuxCtrl + O macOSCmd + O |
| Create a file from a template | Windows / LinuxCtrl + Shift + T macOSCmd + Shift + T |
| Save the current file | Windows / LinuxCtrl + S macOSCmd + S |
| Save the current file as | Windows / LinuxCtrl + Shift + S macOSCmd + Shift + S |
| Print the current file | Windows / LinuxCtrl + P macOSCmd + P |
| Close the current file | Windows / LinuxCtrl + W macOSCmd + W |
| Reopen the most recently closed file | Windows / LinuxCtrl + Shift + T macOSCmd + Shift + T |
| Undo the last edit | Windows / LinuxCtrl + Z macOSCmd + Z |
| Redo the last edit | Windows / LinuxCtrl + Y macOSCmd + Shift + Z |
Editing and formatting
Format code, comment blocks, indent lines, and manage the Editor's live-code tools.
| Action | Shortcuts |
|---|---|
| Insert a line of text | Windows / LinuxAlt + Enter macOSOption + Enter |
| Apply Normal text format | Windows / LinuxCtrl + Alt + T macOSCtrl + Option + T |
| Apply Heading 1 text format | Windows / macOS / LinuxCtrl + Shift + 1 |
| Apply Heading 2 text format | Windows / macOS / LinuxCtrl + Shift + 2 |
| Apply Heading 3 text format | Windows / macOS / LinuxCtrl + Shift + 3 |
| Apply Title text format | Windows / LinuxCtrl + Alt + L macOSCtrl + Option + L |
| Toggle bold text | Windows / LinuxCtrl + B macOSCmd + B |
| Toggle italic text | Windows / LinuxCtrl + I macOSCmd + I |
| Toggle underlined text | Windows / LinuxCtrl + U macOSCmd + U |
| Comment selected lines | Windows / LinuxCtrl + R macOSCmd + / |
| Uncomment code | Windows / LinuxCtrl + Shift + R macOSCmd + Option + / |
| Wrap comments | Windows / LinuxCtrl + J macOSCmd + Shift + W |
| Apply smart indentation | Windows / LinuxCtrl + I macOSCmd + I |
| Indent the selected lines right | Windows / LinuxCtrl + ] macOSCmd + ] |
| Indent the selected lines left | Windows / LinuxCtrl + [ macOSCmd + [ |
| Copy the current line | Windows / LinuxCtrl + L macOSCmd + C |
| Cut the current line | Windows / LinuxCtrl + X macOSCmd + X |
| Duplicate the current line | Windows / LinuxCtrl + Shift + C macOSCmd + Shift + C |
| Change the case of the selection | Windows / LinuxCtrl + Shift + A macOSCmd + Shift + A |
| Move focus between code and output | Windows / LinuxCtrl + Shift + O macOSCmd + Option + O |
| Open or expand a Code Analyzer message | Windows / LinuxCtrl + M macOSCmd + M |
Sections and running code
Run the current section or file and move through code sections from the keyboard.
| Action | Shortcuts |
|---|---|
| Insert a new code section | Windows / LinuxCtrl + Alt + Enter macOSCmd + Option + Enter |
| Run the current section | Windows / LinuxCtrl + Enter macOSCmd + Enter |
| Run the current section and advance | Windows / LinuxCtrl + Shift + Enter macOSCmd + Shift + Enter |
| Run the current file | Windows / LinuxF5 macOSF5orCmd + Option + R |
| Pause the running file | Windows / LinuxCtrl + F5 macOSCmd + F5 |
| Set or clear a breakpoint at the current line | Windows / LinuxF12 macOSCmd + \ |
| Step | Windows / LinuxF10 macOSF10orCmd + Shift + O |
| Step in | Windows / LinuxF11 macOSF11orCmd + Shift + I |
| Step out | Windows / LinuxShift + F11 macOSShift + F11orCmd + Shift + U |
| Quit execution | Windows / macOS / LinuxShift + F5 |
| Move to the previous section | Windows / LinuxCtrl + Up macOSCmd + Up |
| Move to the next section | Windows / LinuxCtrl + Down macOSCmd + Down |
View and desktop focus
Change the Editor view, fold code, check spelling, and move focus around the MATLAB desktop.
| Action | Shortcuts |
|---|---|
| Toggle full-screen Editor mode | Windows / LinuxCtrl + F11 macOSCmd + F11 |
| Expand the current fold | Windows / macOS / LinuxCtrl + Shift + . |
| Collapse the current fold | Windows / macOS / LinuxCtrl + . |
| Expand all folds | Windows / macOS / LinuxCtrl + Shift + , |
| Collapse all folds | Windows / macOS / LinuxCtrl + , |
| Reset the Editor zoom | Windows / LinuxCtrl + Alt + 0 macOSCmd + Option + 0 |
| Find the next spelling issue | Windows / LinuxAlt + F7 macOSOption + F7 |
| Find the previous spelling issue | Windows / LinuxAlt + Shift + F7 macOSOption + Shift + F7 |
| Move to the next desktop group | Windows / LinuxCtrl + F6 macOSCmd + F6 |
| Move to the previous desktop group | Windows / LinuxCtrl + Shift + F6 macOSCmd + Shift + F6 |
| Move focus to the next control | Windows / macOS / LinuxTab |
| Search the MATLAB desktop | Windows / LinuxCtrl + Shift + Space macOSCmd + Shift + Space |
| Open MATLAB Settings | Windows / LinuxCtrl + , macOSCmd + , |
| Interrupt execution | WindowsCtrl + CorCtrl + Break macOSNot documented LinuxCtrl + C |
| Interrupt execution | Windows / LinuxNot documented macOSCmd + . |
Source
official MathWorks MATLAB Editor shortcuts · Checked
Keys can vary by MATLAB release and your OS keyboard settings. You can view or change them in Settings.