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 shortcuts

Editor windows and files

Arrange the Editor, open files, save work, and move between documents.

ActionWindowsmacOSLinux
Maximize or restore the EditorCtrlShiftMCmdShiftMCtrlShiftM
Undock the EditorCtrlShiftUCtrlShiftUCtrlShiftU
Dock the EditorCtrlShiftDCtrlShiftDCtrlShiftD
Activate the EditorCtrlShift0CmdShift0CtrlShift0
Create a new fileCtrlNCmdNCtrlN
Open a fileCtrlOCmdOCtrlO
Create a file from a templateCtrlShiftTCmdShiftTCtrlShiftT
Save the current fileCtrlSCmdSCtrlS
Save the current file asCtrlShiftSCmdShiftSCtrlShiftS
Print the current fileCtrlPCmdPCtrlP
Close the current fileCtrlWCmdWCtrlW
Reopen the most recently closed fileCtrlShiftZCmdShiftZCtrlShiftZ
Undo the last editCtrlZCmdZCtrlZ
Redo the last editCtrlYCmdShiftZCtrlY

Editing and formatting

Format code, comment blocks, indent lines, and manage the Editor's live-code tools.

ActionWindowsmacOSLinux
Insert a live-code sectionAltEnterOptionEnterAltEnter
Open live-editor settingsCtrlAltTCtrlOptionTCtrlAltT
Apply live-code format 1CtrlShift1CtrlShift1CtrlShift1
Apply live-code format 2CtrlShift2CtrlShift2CtrlShift2
Apply live-code format 3CtrlShift3CtrlShift3CtrlShift3
Open the live-code layout menuCtrlAltLCtrlOptionLCtrlAltL
Toggle bold textCtrlBCmdBCtrlB
Toggle italic textCtrlICmdICtrlI
Toggle underlined textCtrlUCtrlUCtrlU
Comment or uncomment selected linesCtrlRCmd/CtrlR
Comment or uncomment a blockCtrlShiftRCmdOption/CtrlShiftR
Join selected linesCtrlJCmdShiftWCtrlJ
Toggle automatic indentationCtrlICmdICtrlI
Indent the selected lines rightCtrl]Cmd]Ctrl]
Indent the selected lines leftCtrl[Cmd[Ctrl[
Clear the current lineCtrlLCmdCCtrlL
Delete the current lineCtrlXCtrlXCtrlX
Copy the current lineCtrlShiftCCtrlShiftCCtrlShiftC
Select the current lineCtrlShiftACtrlShiftACtrlShiftA
Fold the current code sectionCtrlShiftOCmdOptionOCtrlShiftO
Toggle the current blockCtrlMCmdMCtrlM

Sections and running code

Run the current section or file and move through code sections from the keyboard.

ActionWindowsmacOSLinux
Insert a new code sectionCtrlAltEnterCmdOptionEnterCtrlAltEnter
Run the current sectionCtrlEnterCmdEnterCtrlEnter
Run the current section and advanceCtrlShiftEnterCmdShiftEnterCtrlShiftEnter
Run the current fileF5F5F5
Run the file and clear the Command WindowCtrlF5CmdF5CtrlF5
Run the selected codeF12Cmd\F12
Run the next lineF10F10F10
Run the next sectionF11F11F11
Run and stop at the next breakpointShiftF11ShiftF11ShiftF11
Stop running codeShiftF5ShiftF5ShiftF5
Move to the previous sectionCtrlUpCmdUpCtrlUp
Move to the next sectionCtrlDownCmdDownCtrlDown

View and desktop focus

Change the Editor view, fold code, check spelling, and move focus around the MATLAB desktop.

ActionWindowsmacOSLinux
Toggle full-screen Editor modeCtrlF11CmdF11CtrlF11
Fold one levelCtrlShift.CtrlShift.CtrlShift.
Fold two levelsCtrlShift.CtrlShift.CtrlShift.CtrlShift.CtrlShift.CtrlShift.
Unfold one levelCtrlShift,CtrlShift,CtrlShift,
Unfold all levelsCtrlShift,CtrlShift,CtrlShift,CtrlShift,CtrlShift,CtrlShift,
Reset the Editor zoomCtrlAlt0CmdOption0CtrlAlt0
Open the spelling suggestionsAltF7Not documentedAltF7
Find the next spelling errorShiftF7OptionF7ShiftF7
Move to the next desktop groupCtrlF6CmdF6CtrlF6
Move to the previous desktop groupCtrlShiftF6CmdShiftF6CtrlShiftF6
Move focus to the next controlTabTabTab
Search the MATLAB desktopCtrlShiftSpaceCmdShiftSpaceCtrlShiftSpace
Open MATLAB PreferencesCtrl,Cmd,Ctrl,
Open the keyboard shortcut listCtrl/Ctrl/Ctrl/
Interrupt executionCtrl+Break is also documented on Windows.CtrlCNot documentedCtrlC
Interrupt executionNot documentedCmd.Not documented

Make a printable MATLAB sheet