PyCharm keyboard shortcuts

PyCharm is JetBrains' dedicated Python IDE, combining intelligent code completion, powerful refactorings, and first-class debugging and testing tools. It shares the IntelliJ platform keymap, so nearly every action has a keyboard route. Learning these shortcuts keeps your hands on the keys and your focus on the code. This cheat sheet covers 74 default shortcuts for Windows and Mac.

General

Search EverywhereDouble ShiftDouble Shift
Find ActionCtrl+Shift+ACmd+Shift+A
Show intention actions / quick fixesAlt+EnterOption+Enter
Open SettingsCtrl+Alt+SCmd+,
Generate codeAlt+InsertCmd+N
Paste from clipboard historyCtrl+Shift+VCmd+Shift+V

Editing

Duplicate line or selectionCtrl+DCmd+D
Delete lineCtrl+YCmd+Backspace
Toggle line commentCtrl+/Cmd+/
Move line up/downShift+Alt+Up/DownShift+Option+Up/Down
Move statement up/downCtrl+Shift+Up/DownCmd+Shift+Up/Down
Reformat codeCtrl+Alt+LCmd+Option+L
Optimize importsCtrl+Alt+OCtrl+Option+O
Join linesCtrl+Shift+JCtrl+Shift+J
Toggle case of selectionCtrl+Shift+UCmd+Shift+U
Extend selectionCtrl+WOption+Up
Shrink selectionCtrl+Shift+WOption+Down
UndoCtrl+ZCmd+Z
RedoCtrl+Shift+ZCmd+Shift+Z

Code Completion & Info

Basic code completionCtrl+SpaceCtrl+Space
Smart (type-matching) completionCtrl+Shift+SpaceCtrl+Shift+Space
Parameter infoCtrl+PCmd+P
Quick documentationCtrl+QF1
Surround with (if, try, ...)Ctrl+Alt+TCmd+Option+T
Insert live templateCtrl+JCmd+J

Navigation

Go to classCtrl+NCmd+O
Go to fileCtrl+Shift+NCmd+Shift+O
Go to symbolCtrl+Alt+Shift+NCmd+Option+O
Go to lineCtrl+GCmd+L
Go to declaration / usagesCtrl+BCmd+B
Go to implementationCtrl+Alt+BCmd+Option+B
Find usagesAlt+F7Option+F7
File structure popupCtrl+F12Cmd+F12
Recent filesCtrl+ECmd+E
Recent locationsCtrl+Shift+ECmd+Shift+E
Navigate backCtrl+Alt+LeftCmd+[
Navigate forwardCtrl+Alt+RightCmd+]
Next error / warningF2F2
Previous error / warningShift+F2Shift+F2

Refactoring

RenameShift+F6Shift+F6
Refactor This menuCtrl+Alt+Shift+TCtrl+T
Extract methodCtrl+Alt+MCmd+Option+M
Extract variableCtrl+Alt+VCmd+Option+V
Extract constantCtrl+Alt+CCmd+Option+C
Extract parameterCtrl+Alt+PCmd+Option+P
MoveF6F6

Search & Replace

Find in fileCtrl+FCmd+F
Replace in fileCtrl+RCmd+R
Find in files (project-wide)Ctrl+Shift+FCmd+Shift+F
Replace in files (project-wide)Ctrl+Shift+RCmd+Shift+R
Find next occurrenceF3Cmd+G
Find previous occurrenceShift+F3Cmd+Shift+G

Multi-Cursor

Add selection for next occurrenceAlt+JCtrl+G
Unselect last occurrenceShift+Alt+JCtrl+Shift+G
Select all occurrencesCtrl+Alt+Shift+JCtrl+Cmd+G
Add cursor at click positionShift+Alt+ClickShift+Option+Click

Run, Debug & Python Console

Run current configurationShift+F10Ctrl+R
Debug current configurationShift+F9Ctrl+D
Run context configuration (file / test at caret)Ctrl+Shift+F10Ctrl+Shift+R
Execute selection in Python consoleShift+Alt+EShift+Option+E
StopCtrl+F2Cmd+F2
Toggle breakpointCtrl+F8Cmd+F8
Step overF8F8
Step intoF7F7
Step outShift+F8Shift+F8
Resume programF9Cmd+Option+R
Evaluate expressionAlt+F8Option+F8

Version Control & Tool Windows

Commit changesCtrl+KCmd+K
Push commitsCtrl+Shift+KCmd+Shift+K
VCS operations popupAlt+`Ctrl+V
Project tool windowAlt+1Cmd+1
Terminal tool windowAlt+F12Option+F12
Hide all tool windowsCtrl+Shift+F12Cmd+Shift+F12
Return focus to editorEscEsc

Put your top PyCharm shortcuts on real keys

The five PyCharm actions most worth binding to a physical macropad key:

Alt+EnterOption+Enter Show intention actions / quick fixes PyCharm's universal fix-it key; the highest-frequency chord in the IDE.
Ctrl+Shift+F10Ctrl+Shift+R Run context configuration Runs the test or script under the caret; the heart of the Python dev loop.
Ctrl+Alt+LCmd+Option+L Reformat code Instant PEP 8 compliance on every save-and-commit cycle.
Shift+Alt+EShift+Option+E Execute selection in Python console REPL-driven development with one physical key.
Shift+F6Shift+F6 Rename Safe project-wide renames are the most-used refactoring.

I hand-build small-batch programmable macropads (QMK/VIA) in Barcelona. One press, any shortcut, any app.

See the macropads

PyCharm shortcut FAQs

Are PyCharm shortcuts the same as IntelliJ IDEA?
Yes. PyCharm is built on the IntelliJ platform and ships the same default keymaps, plus a few Python-specific actions like executing a selection in the Python console (Shift+Alt+E / Shift+Option+E).
How do I run a single Python file or test in PyCharm?
Put the caret in the file or test and press Ctrl+Shift+F10 on Windows or Ctrl+Shift+R on Mac to run the context configuration. Shift+F10 (Ctrl+R on Mac) reruns the last configuration.
How do I see all keyboard shortcuts in PyCharm?
Open Settings (Ctrl+Alt+S on Windows, Cmd+, on Mac) and go to Keymap to browse, search, and remap every action. Double Shift also finds any action by name.
How do I format Python code in PyCharm?
Press Ctrl+Alt+L on Windows or Cmd+Option+L on Mac to reformat according to your code style (PEP 8 by default). Ctrl+Alt+O (Ctrl+Option+O on Mac) cleans up imports.
What does Alt+Enter do in PyCharm?
Alt+Enter (Option+Enter on Mac) opens intention actions and quick fixes: adding imports, fixing type errors, converting code, and other context-aware suggestions.