MATLAB keyboard shortcuts
MATLAB's Editor shortcuts cover files, navigation, search, code editing, sections, running, folding, and desktop focus. Platform-specific columns are kept separate where MathWorks changes the modifier.
Windows, macOS, Linux · 83 shortcutsEditor windows and files
Arrange the Editor, open files, save work, and move between documents.
| Action | Windows | macOS | Linux |
|---|---|---|---|
| Maximize or restore the Editor | CtrlShiftM | CmdShiftM | CtrlShiftM |
| Undock the Editor | CtrlShiftU | CtrlShiftU | CtrlShiftU |
| Dock the Editor | CtrlShiftD | CtrlShiftD | CtrlShiftD |
| Activate the Editor | CtrlShift0 | CmdShift0 | CtrlShift0 |
| Create a new file | CtrlN | CmdN | CtrlN |
| Open a file | CtrlO | CmdO | CtrlO |
| Create a file from a template | CtrlShiftT | CmdShiftT | CtrlShiftT |
| Save the current file | CtrlS | CmdS | CtrlS |
| Save the current file as | CtrlShiftS | CmdShiftS | CtrlShiftS |
| Print the current file | CtrlP | CmdP | CtrlP |
| Close the current file | CtrlW | CmdW | CtrlW |
| Reopen the most recently closed file | CtrlShiftZ | CmdShiftZ | CtrlShiftZ |
| Undo the last edit | CtrlZ | CmdZ | CtrlZ |
| Redo the last edit | CtrlY | CmdShiftZ | CtrlY |
Editing and formatting
Format code, comment blocks, indent lines, and manage the Editor's live-code tools.
| Action | Windows | macOS | Linux |
|---|---|---|---|
| Insert a live-code section | AltEnter | OptionEnter | AltEnter |
| Open live-editor settings | CtrlAltT | CtrlOptionT | CtrlAltT |
| Apply live-code format 1 | CtrlShift1 | CtrlShift1 | CtrlShift1 |
| Apply live-code format 2 | CtrlShift2 | CtrlShift2 | CtrlShift2 |
| Apply live-code format 3 | CtrlShift3 | CtrlShift3 | CtrlShift3 |
| Open the live-code layout menu | CtrlAltL | CtrlOptionL | CtrlAltL |
| Toggle bold text | CtrlB | CmdB | CtrlB |
| Toggle italic text | CtrlI | CmdI | CtrlI |
| Toggle underlined text | CtrlU | CtrlU | CtrlU |
| Comment or uncomment selected lines | CtrlR | Cmd/ | CtrlR |
| Comment or uncomment a block | CtrlShiftR | CmdOption/ | CtrlShiftR |
| Join selected lines | CtrlJ | CmdShiftW | CtrlJ |
| Toggle automatic indentation | CtrlI | CmdI | CtrlI |
| Indent the selected lines right | Ctrl] | Cmd] | Ctrl] |
| Indent the selected lines left | Ctrl[ | Cmd[ | Ctrl[ |
| Clear the current line | CtrlL | CmdC | CtrlL |
| Delete the current line | CtrlX | CtrlX | CtrlX |
| Copy the current line | CtrlShiftC | CtrlShiftC | CtrlShiftC |
| Select the current line | CtrlShiftA | CtrlShiftA | CtrlShiftA |
| Fold the current code section | CtrlShiftO | CmdOptionO | CtrlShiftO |
| Toggle the current block | CtrlM | CmdM | CtrlM |
Sections and running code
Run the current section or file and move through code sections from the keyboard.
| Action | Windows | macOS | Linux |
|---|---|---|---|
| Insert a new code section | CtrlAltEnter | CmdOptionEnter | CtrlAltEnter |
| Run the current section | CtrlEnter | CmdEnter | CtrlEnter |
| Run the current section and advance | CtrlShiftEnter | CmdShiftEnter | CtrlShiftEnter |
| Run the current file | F5 | F5 | F5 |
| Run the file and clear the Command Window | CtrlF5 | CmdF5 | CtrlF5 |
| Run the selected code | F12 | Cmd\ | F12 |
| Run the next line | F10 | F10 | F10 |
| Run the next section | F11 | F11 | F11 |
| Run and stop at the next breakpoint | ShiftF11 | ShiftF11 | ShiftF11 |
| Stop running code | ShiftF5 | ShiftF5 | ShiftF5 |
| Move to the previous section | CtrlUp | CmdUp | CtrlUp |
| Move to the next section | CtrlDown | CmdDown | CtrlDown |
View and desktop focus
Change the Editor view, fold code, check spelling, and move focus around the MATLAB desktop.
| Action | Windows | macOS | Linux |
|---|---|---|---|
| Toggle full-screen Editor mode | CtrlF11 | CmdF11 | CtrlF11 |
| Fold one level | CtrlShift. | CtrlShift. | CtrlShift. |
| Fold two levels | CtrlShift.CtrlShift. | CtrlShift.CtrlShift. | CtrlShift.CtrlShift. |
| Unfold one level | CtrlShift, | CtrlShift, | CtrlShift, |
| Unfold all levels | CtrlShift,CtrlShift, | CtrlShift,CtrlShift, | CtrlShift,CtrlShift, |
| Reset the Editor zoom | CtrlAlt0 | CmdOption0 | CtrlAlt0 |
| Open the spelling suggestions | AltF7 | Not documented | AltF7 |
| Find the next spelling error | ShiftF7 | OptionF7 | ShiftF7 |
| Move to the next desktop group | CtrlF6 | CmdF6 | CtrlF6 |
| Move to the previous desktop group | CtrlShiftF6 | CmdShiftF6 | CtrlShiftF6 |
| Move focus to the next control | Tab | Tab | Tab |
| Search the MATLAB desktop | CtrlShiftSpace | CmdShiftSpace | CtrlShiftSpace |
| Open MATLAB Preferences | Ctrl, | Cmd, | Ctrl, |
| Open the keyboard shortcut list | Ctrl/ | Ctrl/ | Ctrl/ |
| Interrupt executionCtrl+Break is also documented on Windows. | CtrlC | Not documented | CtrlC |
| Interrupt execution | Not documented | Cmd. | Not documented |