← Back to DevBytes

IntelliJ IDEA Keyboard Shortcuts: Complete Guide

Introduction to IntelliJ IDEA Keyboard Shortcuts

IntelliJ IDEA keyboard shortcuts are predefined key combinations that allow developers to perform virtually any action in the IDE without reaching for the mouse. From navigating across a sprawling codebase to refactoring entire class hierarchies, these shortcuts transform IntelliJ from a simple editor into a precision instrument for software development. They are the secret weapon behind the productivity of thousands of professional Java, Kotlin, Python, and JavaScript developers worldwide.

This guide covers shortcuts based on the default keymap for Windows/Linux. If you are on macOS, replace Ctrl with ⌘ Cmd and Alt with βŒ₯ Opt in most cases. IntelliJ also ships with a macOS-specific keymap that you can select under Settings β†’ Keymap.

Why Keyboard Shortcuts Matter

Relying on the mouse for common operations introduces friction. Every time your hand moves from keyboard to mouse and back, you lose focus and break your flow state. Keyboard shortcuts eliminate this context-switching cost. They also enable actions that are cumbersome through menusβ€”like multi-caret selection, incremental code selection, or quick navigation to a specific method in a 10,000-line file. Mastering shortcuts is not about memorizing a list; it is about rewiring your muscle memory so that the IDE becomes an extension of your thought process.

Essential Shortcuts: The Top 15 You Must Know

πŸš€ Deploy your AI agent in 10 minutes

Managed Hermes hosting. Zero DevOps. 100M tokens/mo included.

Try it free →

If you learn nothing else from this guide, learn these. They form the foundation of efficient IntelliJ usage and will immediately accelerate your daily workflow.

Universal Search and Navigation

Code Editing Power Moves

Selection and Generation

Refactoring and Navigation

Navigation Deep Dive

Navigating code efficiently is perhaps the single biggest productivity multiplier. IntelliJ offers a rich set of shortcuts that let you move through files, classes, and symbols with surgical precision.

Project-Level Navigation

Consider a large Spring Boot application with hundreds of classes. Finding a specific controller method manually would be painful. Instead:

In-File Navigation

Within a single file, these shortcuts keep your hands on the keyboard and your eyes on the code:

Practical Navigation Example

Imagine you are debugging a payment processing service and you need to trace the flow from a REST controller to the actual database query. Here is a sample scenario with the shortcuts you would use:

// File: PaymentController.java
@RestController
public class PaymentController {
    @PostMapping("/payments")
    public ResponseEntity<PaymentResponse> createPayment(@RequestBody PaymentRequest request) {
        // Step 1: Place cursor on processPayment, press Ctrl + B to jump to declaration
        PaymentResponse response = paymentService.processPayment(request);
        return ResponseEntity.ok(response);
    }
}

// File: PaymentService.java (you jumped here with Ctrl + B)
@Service
public class PaymentService {
    public PaymentResponse processPayment(PaymentRequest request) {
        // Step 2: Press Ctrl + Alt + B on validateRequest to see all implementations
        PaymentValidationResult validation = paymentValidator.validateRequest(request);
        // Step 3: Press Ctrl + F12 to open file structure, then type "persist" to jump to the method
        Payment persisted = paymentRepository.save(convertToEntity(request, validation));
        return buildResponse(persisted);
    }
    // ... many other methods below
}

The flow Ctrl + B β†’ Ctrl + Alt + B β†’ Ctrl + F12 followed by typing a method name gets you from the outermost HTTP layer to the database operation in seconds, without ever touching the mouse or scrolling.

Code Editing Shortcuts

Beyond navigation, the editing shortcuts in IntelliJ allow you to manipulate code at a semantic level. These are not simple text operationsβ€”they understand the syntax and structure of your code.

Line and Statement Manipulation

  • Ctrl + D β€” Duplicate Line or Selection: Duplicates the current line or selected block and places it directly below. No clipboard involved. Great for rapidly creating similar test cases or configuration entries.
  • Ctrl + Y β€” Delete Line: Removes the entire line at the cursor. On macOS with the MacOS keymap, this is ⌘ Backspace.
  • Ctrl + Shift + Up/Down β€” Move Statement Up/Down: Moves the selected statement or line up or down, respecting code block boundaries. Unlike cut-and-paste, this automatically adjusts indentation and keeps the code syntactically valid.
  • Alt + Shift + Up/Down β€” Move Line Up/Down: A simpler version that moves lines without semantic awareness. Useful inside comments or plain text files.
  • Ctrl + Shift + U β€” Toggle Case: Switches selected text between UPPERCASE, lowercase, and Title Case.

Multi-Caret Selection

Multi-caret editing is one of the most powerful features in IntelliJ. It allows you to place multiple cursors simultaneously and type or edit at all of them at once.

  • Alt + Shift + Click β€” Add Caret with Mouse: Click to place additional carets at arbitrary positions. Even if you are keyboard-focused, this hybrid approach is sometimes fastest.
  • Ctrl + Shift + Alt + Insert β€” Add Caret to Each Line in Selection: After selecting a rectangular block, places a caret at the start of each line.
  • Alt + Shift + . (period) β€” Add Caret to Next Matched Word: After selecting a word, places carets at all occurrences. Press repeatedly to skip occurrences.

Here is a practical example of multi-caret editing to add a prefix to multiple logger statements:

// Before: select the word "logger.info" in multiple lines using Alt + Shift + .
// Then use multi-caret to edit all lines simultaneously
public void processOrder(Order order) {
    logger.info("Processing order");       // Caret 1 here
    validateOrder(order);
    logger.info("Validation complete");    // Caret 2 here
    fulfillOrder(order);
    logger.info("Fulfillment done");       // Caret 3 here
}

// After editing with multi-caret: type "[ORDER_SERVICE] " at each caret position
public void processOrder(Order order) {
    logger.info("[ORDER_SERVICE] Processing order");
    validateOrder(order);
    logger.info("[ORDER_SERVICE] Validation complete");
    fulfillOrder(order);
    logger.info("[ORDER_SERVICE] Fulfillment done");
}

Code Folding and Expansion

  • Ctrl + . (period) β€” Fold/Unfold Selection: Collapses or expands the selected code block. Repeated presses toggle fold state.
  • Ctrl + Shift + . β€” Fold All Blocks at Level: Collapses all code blocks at a certain nesting level, giving you a high-level overview of the file structure.
  • Ctrl + Shift + + (plus) β€” Expand All: Unfolds all collapsed regions in the file.

Code Generation Shortcuts

IntelliJ excels at generating boilerplate code so you can focus on the meaningful logic. The code generation shortcuts leverage both static templates and dynamic live templates that adapt to the surrounding context.

Static Code Generation

The Generate popup (Alt + Insert) is context-sensitive. Place the cursor inside a class body and invoke it to generate constructors, getters/setters, equals/hashCode, and toString methods. Place it in the Project view to create new files. Place it inside a test class to generate test methods.

// Place cursor inside this class body, press Alt + Insert
// Select "Constructor" β†’ Select all fields β†’ Press Enter
public class UserAccount {
    private String username;
    private String email;
    private LocalDate registrationDate;
    private boolean active;
}

// IntelliJ generates:
public class UserAccount {
    private String username;
    private String email;
    private LocalDate registrationDate;
    private boolean active;

    // Auto-generated constructor
    public UserAccount(String username, String email, LocalDate registrationDate, boolean active) {
        this.username = username;
        this.email = email;
        this.registrationDate = registrationDate;
        this.active = active;
    }
}

Live Templates (Dynamic Snippets)

Live templates are pre-defined code snippets with variable placeholders that you fill in as you type. They are triggered by typing an abbreviation and pressing Tab or Ctrl + J.

  • psvm + Tab β€” Generates public static void main(String[] args) {}
  • sout + Tab β€” Generates System.out.println();
  • fori + Tab β€” Generates an indexed for-loop: for (int i = 0; i < ...; i++) {}
  • iter + Tab β€” Generates an enhanced for-each loop over an iterable variable
  • ifn + Tab β€” Generates if (var == null) {}
  • inn + Tab β€” Generates if (var != null) {}

Here is a live template example demonstrating the iter abbreviation:

// Type "iter" then press Tab (or Ctrl + J)
List<String> names = getNamesFromDatabase();
iter[TAB]   // ← after pressing Tab, IntelliJ expands this to:

List<String> names = getNamesFromDatabase();
for (String name : names) {
    // Cursor lands here, ready to fill in the loop body
}

Surround Templates

Select a block of code and press Ctrl + Alt + T to wrap it with a surrounding construct. This is faster than manually adding braces and repositioning code.

// Select the two lines of validation code, press Ctrl + Alt + T, choose "if"
String username = request.getUsername();
validateNotEmpty(username);   // ← these two lines selected
validateNotReserved(username);

// IntelliJ wraps them:
String username = request.getUsername();
if (username != null) {        // ← condition placeholder, you type the actual check
    validateNotEmpty(username);
    validateNotReserved(username);
}

You can also define your own live templates under Settings β†’ Editor β†’ Live Templates. For instance, create a template named loge that expands to logger.error("$EXPR$", $exception$) for quick error logging.

Refactoring Shortcuts

Refactoring shortcuts in IntelliJ go beyond simple text replacement. They understand the semantics of your code and safely update all references across the entire project. The refactoring engine is one of IntelliJ's crown jewels.

Core Refactoring Operations

  • Shift + F6 β€” Rename: Rename a variable, method, class, or file. All usages, including in XML configuration, string literals, and comments (configurable), are updated atomically. If a naming conflict arises, IntelliJ warns you before applying the change.
  • Ctrl + Alt + M β€” Extract Method: Select a block of code and extract it into a new method. IntelliJ analyzes the selected code, detects which variables must become parameters and which can become the return value, and generates the method signature automatically.
  • Ctrl + Alt + V β€” Extract Variable: Take an expression and introduce a named variable for it. Useful for breaking down complex expressions or giving meaning to magic values.
  • Ctrl + Alt + F β€” Extract Field: Similar to Extract Variable, but introduces a field at the class level instead of a local variable.
  • Ctrl + Alt + C β€” Extract Constant: Replaces a literal value with a named constant (static final field). IntelliJ suggests an appropriate name based on the value.
  • Ctrl + Alt + Shift + T β€” Refactor This: Opens a comprehensive refactoring menu showing all available refactorings for the current context. This is your safety net if you forget a specific shortcut.

Extract Method in Action

Here is a complete before-and-after example of Extract Method refactoring:

// Before: a method with mixed responsibilities
public void registerUser(UserRegistrationRequest request) {
    // Validation block β€” select this entire block, press Ctrl + Alt + M
    if (request.getEmail() == null || !request.getEmail().contains("@")) {
        throw new InvalidRequestException("Invalid email address");
    }
    if (request.getPassword().length() < 8) {
        throw new InvalidRequestException("Password too short");
    }
    if (userRepository.existsByEmail(request.getEmail())) {
        throw new DuplicateUserException("Email already registered");
    }

    // Registration logic
    User user = new User(request.getEmail(), hashPassword(request.getPassword()));
    userRepository.save(user);
    emailService.sendWelcomeEmail(user.getEmail());
}

// After Extract Method (Ctrl + Alt + M), IntelliJ proposes:
public void registerUser(UserRegistrationRequest request) {
    validateRegistrationRequest(request);  // ← extracted method call
    User user = new User(request.getEmail(), hashPassword(request.getPassword()));
    userRepository.save(user);
    emailService.sendWelcomeEmail(user.getEmail());
}

// Auto-generated method:
private void validateRegistrationRequest(UserRegistrationRequest request) {
    if (request.getEmail() == null || !request.getEmail().contains("@")) {
        throw new InvalidRequestException("Invalid email address");
    }
    if (request.getPassword().length() < 8) {
        throw new InvalidRequestException("Password too short");
    }
    if (userRepository.existsByEmail(request.getEmail())) {
        throw new DuplicateUserException("Email already registered");
    }
}

IntelliJ detected that the selected block used request and userRepository but only request needed to become a parameter because userRepository was a class field accessible from the new method. It also correctly inferred the return type void and that exceptions would propagate naturally.

Advanced Refactoring

  • Ctrl + Alt + Shift + M β€” Inline Method: The inverse of Extract Method. Removes a method and inlines its body at all call sites.
  • F6 β€” Move Class/Member: Move a class, method, or field to a different package or class. All references are updated accordingly.
  • Ctrl + F6 β€” Change Signature: Modify a method's name, parameters, return type, or thrown exceptions, and propagate the changes to all callers and overrides.
  • Ctrl + Alt + N β€” Inline Variable/Field: Replaces a variable or field with its literal value or initialization expression at all usage sites, then removes the declaration.

Debugging Shortcuts

Debugging is where keyboard shortcuts truly shine. Stepping through code, evaluating expressions, and manipulating breakpoints without leaving the keyboard dramatically speeds up problem diagnosis.

Starting and Controlling Debug Sessions

  • Shift + F9 β€” Start Debugging: Launches the last run configuration in debug mode. Use Ctrl + Shift + F9 to debug the current context (e.g., the current test method).
  • F8 β€” Step Over: Execute the current line without stepping into any method calls. The workhorse of debugging.
  • F7 β€” Step Into: Enter the method being called on the current line. Use Shift + F7 for Smart Step Into, which lets you choose which specific method to enter when multiple calls appear on one line.
  • Shift + F8 β€” Step Out: Execute the rest of the current method and return to the caller. Essential when you accidentally step into a method you do not care about.
  • F9 β€” Resume Program: Continue execution until the next breakpoint is hit.
  • Alt + F9 β€” Run to Cursor: Execute until reaching the line where the cursor is placed. This acts as a temporary, one-shot breakpoint.

Breakpoint Management

  • Ctrl + F8 β€” Toggle Breakpoint: Add or remove a line breakpoint at the cursor. Use Ctrl + Shift + F8 to open the breakpoint properties dialog for conditional breakpoints.
  • Ctrl + Shift + F8 β€” View All Breakpoints: Opens the Breakpoints dialog where you can manage all breakpoints, set conditions, configure exception breakpoints, and enable/disable breakpoints in bulk.

Expression Evaluation During Debugging

  • Alt + F8 β€” Evaluate Expression: Opens the Evaluate Expression dialog where you can execute arbitrary code in the current stack frame's context. You can call methods, access fields, and even modify state.
  • Alt + Click on Variable β€” Quick Evaluate: While stopped at a breakpoint, Alt+Click on any variable in the editor to see its current value inline.

Here is a debugging scenario with shortcuts in action:

// You suspect that calculateTotal is returning wrong values.
// Set a breakpoint on the line "return total;" with Ctrl + F8.
// Start debugging with Shift + F9.
// When the breakpoint hits, press Alt + F8 to evaluate:
//   "order.getItems().stream().map(Item::getPrice).collect(Collectors.summingDouble(Double::doubleValue))"
// This evaluates the expected total independently of the calculateTotal logic.
// Compare the evaluated expression result with the actual 'total' variable.
// Press F9 to resume, or Shift + F8 to step out of this method.

public double calculateTotal(Order order) {
    double total = 0.0;
    for (OrderItem item : order.getItems()) {
        total += item.getPrice() * item.getQuantity();
        // Optional: set a conditional breakpoint here with Ctrl + Shift + F8
        // Condition: item.getQuantity() <= 0
    }
    return total;  // ← Breakpoint here (Ctrl + F8)
}

Version Control (Git) Shortcuts

IntelliJ's built-in version control integration is deeply keyboard-accessible. You can stage, commit, diff, and resolve conflicts entirely from the keyboard.

  • Alt + ` (backtick) β€” VCS Operations Popup: The universal version control menu. From here you can commit, push, pull, view branches, and access all Git operations. This is the equivalent of the Command Palette for version control.
  • Ctrl + K β€” Commit Changes: Opens the Commit dialog. Review changes, write a commit message, and commit directly. Use Ctrl + Alt + K to commit and push in one step.
  • Ctrl + Shift + K β€” Push Commits: Push your committed changes to the remote repository.
  • Ctrl + T β€” Update Project: Pull changes from the remote (fetch + merge or rebase, depending on configuration).
  • Ctrl + Alt + Z β€” Rollback Changes: Revert selected changes in the current file to match the version control base. Use this to discard unwanted edits line by line or for the entire file.
  • Alt + F10 β€” Show Version Control Tool Window: Opens the VCS tool window showing commits, branches, and file status.

Diff and Merge Shortcuts

  • Ctrl + D β€” Show Diff: When in the Commit dialog or VCS window, shows a side-by-side diff of the selected file's changes. Inside the diff view, use F7/Shift+F7 to navigate between changes.
  • Ctrl + Alt + Shift + Up/Down β€” Next/Previous Change: Jump between modified lines directly in the editor, without opening a separate diff view.

Tool Window Shortcuts

IntelliJ's tool windows (Project, Terminal, Run, Debug, Version Control, etc.) can all be accessed and toggled via keyboard shortcuts. Keeping them hidden when not needed maximizes code real estate.

  • Alt + 1 β€” Project Tool Window: Show or hide the project file tree. Press Enter on a file to open it, or use Ctrl + Shift + F12 to maximize the editor by hiding all tool windows.
  • Alt + 2 β€” Favorites / Bookmarks Tool Window
  • Alt + 3 β€” Find Tool Window
  • Alt + 4 β€” Run Tool Window: Shows test and run output.
  • Alt + 5 β€” Debug Tool Window
  • Alt + 6 β€” Problems Tool Window: Lists all errors and warnings in the current file or project.
  • Alt + 7 β€” Structure Tool Window: A persistent version of the File Structure Popup.
  • Alt + 8 β€” Services Tool Window: For Spring Boot, Docker, and other run configurations.
  • Alt + 9 β€” Version Control Tool Window
  • Alt + F12 β€” Terminal Tool Window: Opens the integrated terminal. Use Ctrl + Shift + ` to open a new terminal session.

Search and Replace Shortcuts

Find and replace operations in IntelliJ are far more powerful than in a basic text editor. They support regex, semantic search, and project-wide scoping.

  • Ctrl + F β€” Find in File: Standard find with regex support, case sensitivity, and word boundary matching. Results are highlighted in-place.
  • Ctrl + R β€” Replace in File: Replace with the same regex and scoping capabilities.
  • Ctrl + Shift + F β€” Find in Path / Project: Search across the entire project, a specific directory, or a custom scope. Supports file type filtering and regex. Results appear in the Find tool window.
  • Ctrl + Shift + R β€” Replace in Path / Project: Project-wide find-and-replace. Use with caution and always preview changes before applying them to all files.
  • Ctrl + Alt + Shift + F7 β€” Find Usages Settings / Show Usages: Opens a detailed usages search dialog where you can configure the scope, search for read vs. write access, and filter by usage type.

Best Practices for Learning and Mastering Shortcuts

Start Small and Build Muscle Memory

Do not try to learn all shortcuts at once. Pick three to five shortcuts each week and force yourself to use them exclusively. Disable the mouse equivalent if necessary. For example, commit to using Alt + Enter for every quick-fix instead of clicking the lightbulb icon. After a week, add three more.

Use the Key Promoter Plugin

IntelliJ includes a built-in feature (enable it under Settings β†’ Appearance & Behavior β†’ Key Promoter) that shows a tooltip every time you perform an action with the mouse that has a keyboard shortcut. The tooltip tells you the shortcut and tracks how many times you have ignored it. This gentle nagging is surprisingly effective at changing habits.

Customize Shortcuts for Your Workflow

Every developer's workflow is unique. IntelliJ's keymap is fully customizable under Settings β†’ Keymap. You can:

  • Duplicate an existing keymap and modify it to create your personal map.
  • Search by action name to find unassigned shortcuts or change existing ones.
  • Import keymaps from other IDEs (Eclipse, VS Code, NetBeans) if you are migrating.
  • Assign shortcuts to specific macros you record for repetitive tasks.

For example, if you frequently run a specific Maven goal, you can assign a shortcut directly to that action. Search for "maven" in the Keymap settings, find the goal execution action, and assign a memorable shortcut.

Practice with the IDE Productivity Guide

IntelliJ ships with a built-in Productivity Guide (access it via Help β†’ Productivity Guide). It tracks your shortcut usage statistics and shows you which features you are underutilizing. Use it as a weekly checklist to identify new shortcuts to adopt.

Learn the "Action Name" Escape Hatch

If you forget a shortcut, press Ctrl + Shift + A to open the Find Action

πŸš€ Need a reliable AI agent for your project?

Deploy Hermes Agent in 10 minutes. Managed hosting, zero DevOps.

Get Started β€” $23.99/mo
← Back to all articles