PyCharm keyboard shortcuts
PyCharm is JetBrains' Python IDE. These default keys run and debug scripts, send code to the Python console, navigate a project and refactor.
Most used PyCharm keyboard shortcuts
The PyCharm shortcuts worth learning first. The full list follows, grouped by task.
- Search everywhereMacShift,ShiftWindowsShift,ShiftLinuxShift,Shift
- Find an actionMacShiftCmdAWindowsCtrlShiftALinuxCtrlShiftA
- Run the current fileMacCtrlShiftRWindowsCtrlShiftF10LinuxCtrlShiftF10
- Debug the current fileMacCtrlShiftDWindowsCtrlShiftF9LinuxCtrlShiftF9
- Run the selection in the Python consoleMacOptionShiftEWindowsAltShiftELinuxAltShiftE
- Show intention actions and quick fixesMacOptionEnterWindowsAltEnterLinuxAltEnter
- Reformat codeMacOptionCmdLWindowsCtrlAltLLinuxCtrlAltL
- RenameMacShiftF6WindowsShiftF6LinuxShiftF6
- Find usagesMacOptionF7WindowsAltF7LinuxAltF7
- Go to the declarationMacCmdBWindowsCtrlBLinuxCtrlB
- TerminalMacOptionF12WindowsAltF12LinuxAltF12
Run Python code and debug in PyCharm
- Run the last configurationMacCtrlRWindowsShiftF10LinuxShiftF10
- Debug the last configurationMacCtrlDWindowsShiftF9LinuxShiftF9
- Step overMacF8WindowsF8LinuxF8
- Step intoMacF7WindowsF7LinuxF7
- Step outMacShiftF8WindowsShiftF8LinuxShiftF8
- ResumeMacOptionCmdRWindowsF9LinuxF9
- Run to the cursorMacOptionF9WindowsAltF9LinuxAltF9
- Evaluate an expressionMacOptionF8WindowsAltF8LinuxAltF8
- Run only the selected code
- Select lines and press Alt+Shift+E (Option+Shift+E on Mac) to send them to the Python console.
Run and debug
12 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Run the current file | CtrlShiftR | CtrlShiftF10 | CtrlShiftF10 |
| Debug the current file | CtrlShiftD | CtrlShiftF9 | CtrlShiftF9 |
| Run the last configuration | CtrlR | ShiftF10 | ShiftF10 |
| Debug the last configuration | CtrlD | ShiftF9 | ShiftF9 |
| Run the selection in the Python console | OptionShiftE | AltShiftE | AltShiftE |
| Toggle a breakpoint | CmdF8 | CtrlF8 | CtrlF8 |
| Step overDebugging | F8 | F8 | F8 |
| Step intoDebugging | F7 | F7 | F7 |
| Step outDebugging | ShiftF8 | ShiftF8 | ShiftF8 |
| ResumeDebugging | OptionCmdR | F9 | F9 |
| Run to the cursorDebugging | OptionF9 | AltF9 | AltF9 |
| Evaluate an expressionDebugging | OptionF8 | AltF8 | AltF8 |
Search and navigation
14 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Search everywhere | Shift,Shift | Shift,Shift | Shift,Shift |
| Find an action | ShiftCmdA | CtrlShiftA | CtrlShiftA |
| Go to a class | CmdO | CtrlN | CtrlN |
| Go to a file | ShiftCmdO | CtrlShiftN | CtrlShiftN |
| Recent files | CmdE | CtrlE | CtrlE |
| Go to a line | CmdL | CtrlG | CtrlG |
| File structure | CmdF12 | CtrlF12 | CtrlF12 |
| Go to the declaration | CmdB | CtrlB | CtrlB |
| Find usages | OptionF7 | AltF7 | AltF7 |
| Back | Cmd[ | CtrlAlt← | CtrlAlt← |
| Forward | Cmd] | CtrlAlt→ | CtrlAlt→ |
| Quick documentation | F1 | CtrlQ | CtrlQ |
| Find in files | ShiftCmdF | CtrlShiftF | CtrlShiftF |
| Replace in files | ShiftCmdR | CtrlShiftR | CtrlShiftR |
Editing
13 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Show intention actions and quick fixes | OptionEnter | AltEnter | AltEnter |
| Basic completion | CtrlSpace | CtrlSpace | CtrlSpace |
| Parameter info | CmdP | CtrlP | CtrlP |
| Reformat code | OptionCmdL | CtrlAltL | CtrlAltL |
| Optimize imports | CtrlOptionO | CtrlAltO | CtrlAltO |
| Comment with line comment | Cmd/ | Ctrl/ | Ctrl/ |
| Duplicate the line | CmdD | CtrlD | CtrlD |
| Delete the line | CmdBackspace | CtrlY | CtrlY |
| Move the statement up | ShiftCmd↑ | CtrlShift↑ | CtrlShift↑ |
| Move the statement down | ShiftCmd↓ | CtrlShift↓ | CtrlShift↓ |
| Extend the selection | Option↑ | CtrlW | CtrlW |
| Surround with (if, try, with) | OptionCmdT | CtrlAltT | CtrlAltT |
| Generate code | CmdN | AltInsert | AltInsert |
Refactoring and tools
9 shortcuts| Action | Mac | Windows | Linux |
|---|---|---|---|
| Rename | ShiftF6 | ShiftF6 | ShiftF6 |
| Extract method | OptionCmdM | CtrlAltM | CtrlAltM |
| Extract variable | OptionCmdV | CtrlAltV | CtrlAltV |
| Refactor this | CtrlT | CtrlAltShiftT | CtrlAltShiftT |
| Terminal | OptionF12 | AltF12 | AltF12 |
| Project tool window | Cmd1 | Alt1 | Alt1 |
| Commit | CmdK | CtrlK | CtrlK |
| Push | ShiftCmdK | CtrlShiftK | CtrlShiftK |
| Settings | Cmd, | CtrlAltS | CtrlAltS |
No shortcuts match. Try fewer words, the key names only, or search every app.
Show the key map: which keys PyCharm uses mostDarker orange = used by more shortcuts
Comment, format and indent code in PyCharm
- Optimize importsMacCtrlOptionOWindowsCtrlAltOLinuxCtrlAltO
- Duplicate the lineMacCmdDWindowsCtrlDLinuxCtrlD
- Delete the lineMacCmdBackspaceWindowsCtrlYLinuxCtrlY
- Move the statement upMacShiftCmd↑WindowsCtrlShift↑LinuxCtrlShift↑
- Move the statement downMacShiftCmd↓WindowsCtrlShift↓LinuxCtrlShift↓
- Extend the selectionMacOption↑WindowsCtrlWLinuxCtrlW
- Surround with (if, try, with)MacOptionCmdTWindowsCtrlAltTLinuxCtrlAltT
- Generate codeMacCmdNWindowsAltInsertLinuxAltInsert
- Comment multiple lines
- Select the lines and press Ctrl+/ (Cmd+/ on Mac); the same keys uncomment them. Ctrl+Shift+/ wraps a selection in a block comment where the language has one.
- Indent
- Tab and Shift+Tab indent and unindent the selected lines; Ctrl+Alt+I (Ctrl+Option+I) fixes their indentation.
- Format JSON and other files
- Ctrl+Alt+L (Cmd+Option+L) reformats any open file, including JSON, HTML and SQL.
- Collapse all functions
- Ctrl+Shift+Minus (Cmd+Shift+Minus) folds every block; Ctrl+Shift+Plus unfolds them.
Terminal, project window and Git shortcuts in PyCharm
- Project tool windowMacCmd1WindowsAlt1LinuxAlt1
- CommitMacCmdKWindowsCtrlKLinuxCtrlK
- PushMacShiftCmdKWindowsCtrlShiftKLinuxCtrlShiftK
- SettingsMacCmd,WindowsCtrlAltSLinuxCtrlAltS
- New file
- Select a folder in the Project window and press Alt+Insert (Cmd+N on Mac) to create a Python file or any other file type.
- Zoom the editor
- Turn on Change font size with Ctrl+Mouse Wheel in Settings > Editor > General, then zoom with the mouse wheel.
Change PyCharm shortcuts or use VS Code keys
Settings > Keymap (Ctrl+Alt+S, or Cmd+Comma on Mac) lists every PyCharm shortcut. PyCharm shares its keymap with the other JetBrains IDEs, so the steps in changing the IntelliJ IDEA keymap work here too.
- Coming from VS Code or Jupyter
- Pick the VS Code keymap at the top of Settings > Keymap so Ctrl+Shift+P, Ctrl+P and Ctrl+/ behave as you expect; Jupyter notebooks in PyCharm Professional keep the Shift+Enter and Ctrl+Enter keys to run cells.
PyCharm keyboard shortcuts: questions
- How do I run a Python file in PyCharm?
- Press Ctrl+Shift+F10 (Ctrl+Shift+R on a Mac) to run the file in the editor. Shift+F10 (Ctrl+R on a Mac) runs the last configuration again.
- Why are PyCharm keyboard shortcuts not working?
- Another program or the system may take the keys first (Ubuntu workspaces use Ctrl+Alt+arrows, macOS uses some F-keys). Check Settings > Keymap for a changed or switched keymap, and on laptops whether F-key shortcuts need Fn.
- How do I add a PyCharm shortcut to the desktop on Ubuntu?
- Install PyCharm with the JetBrains Toolbox App, which creates the menu and desktop entries for you, or install it as a snap (sudo snap install pycharm-community --classic).
These are the default key bindings in PyCharm 2025.2, as published by JetBrains. Shortcuts that need an extension, an add-in or a changed keymap are left out. Where two combinations do the same thing, both are shown.
Single-system lists: PyCharm keyboard shortcuts for Mac, PyCharm keyboard shortcuts for Windows, PyCharm keyboard shortcuts for Linux.
Each shortcut has its own page with the keys for every system, related shortcuts and the same action in other apps. The printable cheat sheet fits the whole list on one or two pages.