IntelliJ IDEA Cheatsheet - Java IDE Shortcut Reference
IntelliJ is powerful enough to be slow to learn; the shortcuts are the unlock. This reference groups navigation, editing/refactoring, generation/completion, run/debug stepping, VCS and layout. It flags high-yield keys like Search Everything, Generate, and Rename across the hierarchy, plus the debugger stepping set. For Java/Kotlin work where jumping between related classes and runtime state is constant. After reading you navigate, refactor and debug without breaking to the mouse.
Typical Use Case
For engineers doing JVM or multi-language development in IntelliJ IDEA, with macOS keys. Six areas cover the main flow: navigation, editing and refactoring, completion, running and debugging, version control, and window management. Three habits are worth building first — Shift+Shift as the universal entry point when you do not know where something lives, Cmd+B and Cmd+Alt+B to jump between declaration and implementation when reading unfamiliar code, and Cmd+Alt+L plus Cmd+Alt+O as the fixed routine before committing. Alt+Enter resolves warnings in place, and Shift+F6 is far safer than find and replace for renames. Debug with F8 to step over, F7 to step in, Shift+F8 to step out.
Editing & Refactoring 13
Cmd+DCmd+YCmd+/Cmd+Alt+/Cmd+Alt+LCmd+Alt+OShift+F6Cmd+Alt+VCmd+Alt+MCmd+Alt+CCmd+Alt+FCmd+Alt+NAlt+EnterCode Completion 7
Ctrl+SpaceCtrl+Shift+SpaceCmd+PCmd+QF4Alt+JCmd+Alt+TRun & Debug 10
Ctrl+RCtrl+DCtrl+Shift+RCtrl+Shift+DF8F7Shift+F8Alt+F9Cmd+F8Cmd+Shift+F8Version Control 6
Cmd+KCmd+TCmd+Shift+KAlt+`Cmd+9Alt+3Window Management 8
Cmd+1Cmd+4Cmd+5Cmd+7Cmd+Shift+F12Cmd+,Cmd+;Shift+ShiftParameter matrix
| Parameter | Effect | Example |
|---|---|---|
Shift+Shift | Search Everywhere, global search across classes/files/symbols/actions | Shift+Shift |
Cmd+O | Go to class | Cmd + O |
Cmd+Shift+O | Go to file | Cmd + Shift + O |
Cmd+Alt+L | Go to symbol (method/variable) | Cmd + Alt + L |
Cmd+B | Go to declaration | Cmd + B |
Cmd+Alt+B | Go to implementation | Cmd + Alt + B |
Cmd+U | Go to superclass/interface | Cmd + U |
Alt+F7 | Find usages (list all call sites) | Alt + F7 |
Cmd+[ / Cmd+] | Navigate back to previous position / forward to next position | Cmd + [ |
F2 / Shift+F2 | Jump to next / previous compile error | F2 |
Cmd+D | Duplicate current line | Cmd + D |
Cmd+Y | Delete current line | Cmd + Y |
Cmd+/ / Cmd+Alt+/ | Toggle line comment / block comment | Cmd + / |
Cmd+Alt+L | Reformat code | Cmd + Alt + L |
Cmd+Alt+O | Optimize imports | Cmd + Alt + O |
Shift+F6 | Rename and auto-update references | Shift + F6 |
Cmd+Alt+V | Extract variable | Cmd + Alt + V |
Cmd+Alt+M | Extract method | Cmd + Alt + M |
Cmd+Alt+C | Extract constant | Cmd + Alt + C |
Cmd+Alt+F | Extract field | Cmd + Alt + F |
Cmd+Alt+N | Inline | Cmd + Alt + N |
Cmd+Alt+T | Wrap with template (if/for/try) | Cmd + Alt + T |
Alt+Enter | Quick fix / suggestion (catch-all) | Alt + Enter |
Ctrl+Space | Basic code completion | Ctrl + Space |
Ctrl+Shift+Space | Smart completion (completes chained calls) | Ctrl + Shift + Space |
Cmd+P | View parameter info | Cmd + P |
Cmd+Q | Quick documentation | Cmd + Q |
F4 | View source | F4 |
Alt+J | Select next occurrence | Alt + J |
Ctrl+R | Run current configuration | Ctrl + R |
Ctrl+D | Debug current configuration | Ctrl + D |
Ctrl+Shift+R | Run current file | Ctrl + Shift + R |
Ctrl+Shift+D | Debug current file | Ctrl + Shift + D |
F8 / F7 / Shift+F8 | Step over / step into / step out | F8 |
Alt+F9 | Run to cursor | Alt + F9 |
Cmd+F8 / Cmd+Shift+F8 | Toggle breakpoint / view all breakpoints | Cmd + F8 |
Cmd+K | Commit | Cmd + K |
Cmd+T | Pull | Cmd + T |
Cmd+Shift+K | Push | Cmd + Shift + K |
Alt+` | VCS operations popup | Alt + ` |
Cmd+9 | Open Git tool window | Cmd + 9 |
Cmd+1 / 4 / 5 / 7 | Open Project / Run / Debug / Structure panels | Cmd + 1 |
Cmd+Shift+F12 | Maximize editor | Cmd + Shift + F12 |
Cmd+, | Open settings | Cmd + , |
Cmd+; | Open project structure | Cmd + ; |
Common pitfalls
SymptomAfter formatting, the code produces a large unrelated diff against teammates' versions.
CauseThe Code Style config differs from the team's; formatting reorders indentation, line breaks, or quotes per each side's own rules.
FixFirst set Code Style to the team convention in settings and commit the config file to the repo; run Cmd+Alt+L consistently before committing.
SymptomAfter renaming, some places still reference the old name and compilation fails with cannot find symbol.
CauseOccurrences in string constants, XML, or reflection config are not covered by the IDE's reference index.
FixShift+F6 lists all references it recognizes for you to confirm one by one; for the remaining scattered spots use Cmd+Shift+F to search the old name globally and fix them.
SymptomCmd shortcuts do nothing in the Windows version of the IDE.
CauseThis sheet is based on macOS keybindings; the Windows equivalents differ (Ctrl / Alt combos).
FixUse Shift+Shift to search by action name; the panel shows the correct keybinding for the current OS.
SymptomWhile debugging you keep stepping into third-party libraries and never see your own business code.
CauseF7 steps into every function call, including external library implementations, so the call stack goes ever deeper.
FixBy default use F8 to step over and only F7 into calls when you need to inspect the logic; after stepping in, use Shift+F8 to return to the caller immediately.
SymptomThe Alt+Enter suggestions offer several options and picking the wrong one rewrites the code in a way you did not want.
CauseThe quick-fix list mixes different categories such as Intention, Inspection, and Refactor, and each selected item behaves differently.
FixRead the full description of the prompt before applying; for options with a wide rewriting scope, press Cmd+Z to undo and switch to a specific refactoring action instead.
SymptomExtract Variable or Extract Method reports that it cannot extract, or the logic changes after extraction.
CauseThe selection is not a single complete expression, crosses statement boundaries, or contains side effects (increment, assignment, function call), so the IDE refuses or splits it incorrectly.
FixSelect only one complete expression and add parentheses to pin down precedence when needed; split expressions with side effects into several steps before extracting.
SymptomThe file you just created is missing from the Git commit panel.
CauseNew files are untracked and must be added to the staging area first.
FixOpen the Git tool window with Cmd+9, check the Changes and Untracked groups, add the file, then run Cmd+K.
SymptomIrrelevant entries appear among the smart-completion candidates, and a wrong pick means a pile of references to redo.
CauseCtrl+Shift+Space smart completion expands long chained calls based on context, so a long candidate list is easy to mis-select.
FixFirst use Cmd+P to check the method signature and parameters, then press Enter; when unsure, fall back to basic completion with Ctrl+Space and select step by step.
Troubleshooting
1The go-to entry point when you do not know where something is
Shift+Shift → type class / file / method / action nameSearch Everywhere searches four kinds of content: classes, files, symbols, and command actions. If a class cannot be found, it is usually because the index is not built yet or dependencies have not finished downloading; trigger a project build first and try again.
2The three-step navigation combo for reading unfamiliar code
Cmd+B (go to declaration) → Cmd+Alt+B (go to implementation) → Alt+F7 (find usages) → Cmd+U (go to superclass)Jump from the interface to the implementation to see the real logic, then use Alt+F7 to list all call sites and confirm the impact scope, and Cmd+U to return to the abstraction. These four steps quickly build a global understanding of unfamiliar code.
3The fixed three steps before committing
Cmd+Alt+L (reformat) → Cmd+Alt+O (optimize imports) → Cmd+K (commit)Formatting unifies the style and optimizing imports clears unused ones; after these two steps the diff contains only real logic changes. Then commit with Cmd+K for the least review noise.
4Refactor and verify before committing
Shift+F6 (rename) → Cmd+Alt+V (extract variable) → Cmd+Alt+M (extract method) → Cmd+Alt+N (inline)Confirm the reference list one by one when renaming; extraction separates long expressions and duplicated logic for better readability; inline removes intermediate variables used only once. After running the sequence the diff is structural and does not change behavior.
5Standard debugging workflow
Ctrl+D (debug) → Cmd+F8 (toggle breakpoint) → F8 / F7 / Shift+F8 → Alt+F9 (run to cursor)F8 steps over one line in the current function, F7 steps into a function, and Shift+F8 returns to the caller; Alt+F9 suits cases where you only want to run up to the line before the failure. Use Cmd+Shift+F8 to check whether breakpoints land on the actual execution path.
6Quick jumps for compile errors
F2 (next error) → Shift+F2 (previous error) → Alt+Enter (fix in place)F2 jumps through the build error list one by one, faster than scrolling the console manually; once at the error line press Alt+Enter to see available fixes (such as generating a missing method or adding an import), and anything auto-fixable need not be edited by hand.
7View the call chain and quick documentation
Cmd+P (parameter info) → Cmd+Q (quick documentation) → F4 (view source)Hover over a method name and use Cmd+P for the full parameter list and Cmd+Q for the docs; for JDK or third-party classes press F4 to jump straight to the source to confirm the implementation, the most reliable way to determine behavior.
Command Examples
Locate first with Search Everywhere, then jump to the definition
Shift+Shift (type class name)
Cmd+O (type class name)
Cmd+BBrowsing a thousand-file repo by tree almost never hits. Search Everywhere is index-backed, Cmd+O targets a class exactly, and Cmd+B opens its definition — the fastest way to orient yourself in unfamiliar code.
Confirm every call site before renaming a signature
Cmd+B (go to declaration)
Alt+F7 (find usages)
Shift+F6Shift+F6 renames semantically, including string references and tests. But if the target class comes from a jar without attached sources, only in-project call sites get updated and external callers are silently missed. Always re-check with Alt+F7 afterwards.
Run to cursor instead of stepping line by line
Cmd+F8 (toggle breakpoint)
Alt+F9 (run to cursor)
F7 (step into)
F8 (step over)
Shift+F8 (step out)Stepping through a loop with F8 is a trap. Break outside the loop, Alt+F9 straight to the cursor, and only use F7/F8 when one specific line is suspect; Shift+F8 pops back out.
Find the conflicting keymap instead of hammering the shortcut
Cmd+, (search Keymap in settings)
Search the target action → right-click to see if it is already bound
If it conflicts choose Add Keyboard Shortcut or RemoveA shortcut that suddenly stops working usually means two keymaps (your custom one or a Vim/Emacs plugin) collided. Search the action in Keymap settings, inspect all bound combos on the right, then unbind or rebind via the context menu. If the action seems missing, first confirm you are actually in the keymap you think you are.
Rolling back a bad settings change
Cmd+, (Settings)
Search Version Control → Local History
Right-click Settings.xml or the target file → RevertIDEA settings have no undo button. After breaking a keymap, plugin, or index setting, recover the file version through Local History. Whether .idea/ is also recoverable via git depends entirely on your .gitignore — a separate rollback path.
Common Pitfalls
- Shift+F6 also rewrites string literals, reflection names, and config keys. Renaming a public interface breaks every compiled caller unless you keep a deprecated alias.
- Editing code during a debug session and re-running without rebuilding executes the old class — when a fix "does not take effect", check the build artifact first.
- Alt+F9 (Run to Cursor) only applies to the current session; all breakpoints die when it ends, so you can misjudge whether your repro conditions still hold.
- There is no undo for Settings. Before deleting .idea/ in frustration, try to revert the single broken entry in Keymap/Plugins — deleting the directory throws away run configurations, indexes, and Local History.
- Pushing with Cmd+Shift+K without checking the staged changes can commit breakpoint files or a .env containing secrets; review the diff in the VCS popup (Alt+backtick) first.
- Find (Alt+F3) and Search Everywhere (Shift+Shift) have different scopes — a replace done in Alt+F3 can miss generated code, so re-verify cross-module edits with Shift+Shift.
Tips
- Alt+Enter is the universal shortcut; pressing it on a warning/error shows a fix suggestion.
- Shift+Shift quickly searches anything (classes, files, symbols, actions).
- Before Cmd+Alt+L reformats code, set up the Code Style first.
FAQ
Which keys jump to a definition versus find usages, and how do I follow an interface implementation?
Cmd+B goes to the definition of the symbol under the cursor, Alt+F7 searches backwards for all usages, Cmd+Alt+B jumps to the concrete implementation, and Cmd+U jumps to the superclass or interface declaration. When reading framework code or chasing an implementation, moving along Cmd+B → Cmd+Alt+B → Cmd+U walks you between abstraction and implementation far more precisely than a text search. Cmd+[ and Cmd+] step back and forward through visited locations, which pairs well with that chain.
What does Shift+Shift search, and why learn it before the navigation keys?
Shift+Shift opens Search Everywhere: one input box that searches classes, files, symbols, actions and settings, including third-party library classes that do not appear in the Project tree. It is the only entry point that does not require you to already know where something lives — search the action name when you cannot recall the shortcut, search a business keyword when you cannot recall the class name. Cmd+P for parameter info and Cmd+Q for quick docs add context once you have located the symbol; plain global text search is still Cmd+Shift+F.
Why is Alt+Enter called the universal shortcut, and what does it actually solve?
It is the entry point for context-sensitive intention actions. With the caret on a line that fails to compile it offers quick fixes; on a class definition it can generate a constructor or getters and setters; with an expression selected it can extract a variable or constant (the same work as Cmd+Alt+V and Cmd+Alt+C); on an interface method it can generate an implementation, and inside a test class a test method. What it saves is hunting through menus — describe your intent at the caret and let the IDE offer executable options.
What should be prepared before a rename or extract-method so the refactor does not fail?
Make sure indexing has completed and the project compiles, since refactorings rely on symbol resolution and will refuse to run or silently miss references on a partial index. Before Shift+F6, check the new name does not collide with an existing class or a statically imported symbol. For Cmd+Alt+M, the selection must not straddle an unclosed construct, and any local variables the block references become parameters. And set your Code Style before running Cmd+Alt+L, or a bulk format will rewrite the file in the default style.
How do I control stepping in a debug session, and how do I get out when something goes wrong?
Control the pace with F8 to step over, F7 to step in, Shift+F8 to step out and Alt+F9 to run to the line holding the cursor. Toggle breakpoints with Cmd+F8 and review them all at once with Cmd+Shift+F8 so you know which module is instrumented. Enter through Ctrl+R to run the current configuration or Ctrl+D to debug it, with Ctrl+Shift+R and Ctrl+Shift+D running just the current file when it needs different parameters. Cmd+F2 stops and Cmd+Alt+R resumes.
Official References
Each command links to its official documentation below, so you can verify the latest usage and read deeper.
Maintained by LaoHand
Publicly updated on Jul 21, 2026, continuously proofread against official docs.
Contact Us
Wrong command or description? Send us corrections, business inquiries or product feedback by email.
Contact Us