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 · 83 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 + Z macOSCmd + Shift + Z |
| 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 live-code section | Windows / LinuxAlt + Enter macOSOption + Enter |
| Open live-editor settings | Windows / LinuxCtrl + Alt + T macOSCtrl + Option + T |
| Apply live-code format 1 | Windows / macOS / LinuxCtrl + Shift + 1 |
| Apply live-code format 2 | Windows / macOS / LinuxCtrl + Shift + 2 |
| Apply live-code format 3 | Windows / macOS / LinuxCtrl + Shift + 3 |
| Open the live-code layout menu | 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 / macOS / LinuxCtrl + U |
| Comment or uncomment selected lines | Windows / LinuxCtrl + R macOSCmd + / |
| Comment or uncomment a block | Windows / LinuxCtrl + Shift + R macOSCmd + Option + / |
| Join selected lines | Windows / LinuxCtrl + J macOSCmd + Shift + W |
| Toggle automatic indentation | Windows / LinuxCtrl + I macOSCmd + I |
| Indent the selected lines right | Windows / LinuxCtrl + ] macOSCmd + ] |
| Indent the selected lines left | Windows / LinuxCtrl + [ macOSCmd + [ |
| Clear the current line | Windows / LinuxCtrl + L macOSCmd + C |
| Delete the current line | Windows / macOS / LinuxCtrl + X |
| Copy the current line | Windows / macOS / LinuxCtrl + Shift + C |
| Select the current line | Windows / macOS / LinuxCtrl + Shift + A |
| Fold the current code section | Windows / LinuxCtrl + Shift + O macOSCmd + Option + O |
| Toggle the current block | 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 / macOS / LinuxF5 |
| Run the file and clear the Command Window | Windows / LinuxCtrl + F5 macOSCmd + F5 |
| Run the selected code | Windows / LinuxF12 macOSCmd + \ |
| Run the next line | Windows / macOS / LinuxF10 |
| Run the next section | Windows / macOS / LinuxF11 |
| Run and stop at the next breakpoint | Windows / macOS / LinuxShift + F11 |
| Stop running code | 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 |
| Fold one level | Windows / macOS / LinuxCtrl + Shift + . |
| Fold two levels | Windows / macOS / LinuxCtrl + Shift + . then Ctrl + Shift + . |
| Unfold one level | Windows / macOS / LinuxCtrl + Shift + , |
| Unfold all levels | Windows / macOS / LinuxCtrl + Shift + , then Ctrl + Shift + , |
| Reset the Editor zoom | Windows / LinuxCtrl + Alt + 0 macOSCmd + Option + 0 |
| Open the spelling suggestions | Windows / LinuxAlt + F7 macOSNot documented |
| Find the next spelling error | Windows / LinuxShift + F7 macOSOption + 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 Preferences | Windows / LinuxCtrl + , macOSCmd + , |
| Open the keyboard shortcut list | Windows / macOS / LinuxCtrl + / |
| Interrupt executionCtrl+Break is also documented on Windows. | Windows / LinuxCtrl + C macOSNot documented |
| Interrupt execution | Windows / LinuxNot documented macOSCmd + . |
Source
official MathWorks MATLAB Editor shortcuts · Checked
Current MATLAB Editor and desktop keyboard-shortcut tables checked September 1, 2026. The exact set depends on MATLAB release and operating-system keyboard settings; users can inspect or change bindings in Preferences.