NetBeans Keyboard Shortcuts: Complete List for Windows & Mac (2026)

NetBeans keyboard shortcuts let you navigate, edit, debug, and refactor code without reaching for the mouse saving hours over a typical development week. NetBeans is a free, open-source IDE maintained by the Apache Software Foundation, and it ships with the same shortcut system across Windows, Linux, and macOS.

This guide lists 100+ NetBeans shortcuts organized by task from the most-used commands to debugging, refactoring, and Java code templates with both Windows and Mac key combinations. You’ll also find how to duplicate a line, comment code, customize your own shortcuts, and a free one-page PDF cheat sheet to download. All shortcuts are verified against current NetBeans releases (NetBeans 30 and earlier).

Most-used NetBeans shortcuts at a glance:

  • Duplicate line: Ctrl + Shift + Up/Down (Windows) · Alt + Shift + Up/Down (Mac)
  • Comment/uncomment: Ctrl + / (toggle)
  • Format code: Alt + Shift + F
  • Delete line: Ctrl + E
  • Go to declaration: Ctrl + B
  • Find usages: Alt + F7
  • Run project: F6 · Debug: Ctrl + F5
  • Fix imports: Ctrl + Shift + I

What Is NetBeans?

NetBeans is a free, open-source integrated development environment (IDE) used for developing applications in Java, PHP, JavaScript, HTML5, and C/C++. Originally created by Roman Staněk and later developed by Sun Microsystems, NetBeans was donated to the Apache Software Foundation by Oracle in 2016, where it is now a top-level Apache project. It runs on Windows, macOS, Linux, and any system with a compatible Java Development Kit (JDK), and is released on a quarterly schedule.

Is NetBeans free and open source?

Yes. NetBeans is completely free for both commercial and non-commercial use under the Apache License 2.0, and its full source code is publicly available on GitHub.

Most Used NetBeans Shortcuts

ActionWindows / LinuxMac
Go to typeCtrl + O⌘ + O
Go to fileAlt + Shift + O⌘ + Shift + O
Go to declarationCtrl + B⌘ + B
Go to sourceCtrl + Shift + B⌘ + Shift + B
Go to lineCtrl + GCtrl + G
Go to last editCtrl + Q⌘ + Q
Go to Unit testCtrl + Shift + T⌘ + Shift + T
Copy file pathAlt + Shift + L⌘ + Shift + L
Toggle bookmarkCtrl + Shift + M⌘ + Shift + M
Next bookmarkCtrl + Shift + .⌘ + Shift + .
Previous bookmarkCtrl + Shift + ,⌘ + Shift + ,
Next compile errorCtrl + .⌘ + .
Previous compile errorCtrl + ,⌘ + ,
Move caret to matching bracketCtrl + [⌘ + [
Go backwardAlt + Left⌘ + Left
Go forwardAlt + Right⌘ + Right
Select in ProjectsCtrl + Shift + 1⌘ + Shift + 1
Select in FilesCtrl + Shift + 2⌘ + Shift + 2
Select in FavoritesCtrl + Shift + 3⌘ + Shift + 3
Jump to quick searchCtrl + I⌘ + I

Search & Navigation Shortcuts

ActionWindows / LinuxMac
Find in fileCtrl + F⌘ + F
Find nextF3⌘ + G
Find previousShift + F3⌘ + Shift + G
Search word at caretCtrl + F3⌘ + F3
Next word matchCtrl + K⌘ + K
Previous word matchCtrl + Shift + K⌘ + Shift + K
Replace in fileCtrl + H⌘ + R
Find in projectsCtrl + Shift + F⌘ + Shift + F
Replace in projectsCtrl + Shift + H⌘ + Shift + H
Find usagesAlt + F7Ctrl + F7

Text Editing Shortcuts

ActionWindows / LinuxMac
Duplicate line upCtrl + Shift + UpAlt + Shift + Up
Duplicate line downCtrl + Shift + DownAlt + Shift + Down
Move line upAlt + Shift + UpCtrl + Shift + Up
Move line downAlt + Shift + DownCtrl + Shift + Down
Shift line leftAlt + Shift + LeftCtrl + Shift + Left
Shift line rightAlt + Shift + RightCtrl + Shift + Right
Delete current lineCtrl + E⌘ + E
Comment / uncomment (toggle)Ctrl + /⌘ + /
Comment linesCtrl + Shift + C⌘ + Shift + C
Format code / selectionAlt + Shift + FCtrl + Shift + F
Fix all importsCtrl + Shift + I⌘ + Shift + I
Fix selected importAlt + Shift + ICtrl + Shift + I
Generate codeAlt + InsertCtrl + Enter
Paste formattedCtrl + Shift + V⌘ + Shift + V
Show clipboard historyCtrl + Shift + D⌘ + Shift + D
Rectangular selectionCtrl + Shift + R⌘ + Shift + R
Select identifierAlt + Shift + JCtrl + Shift + J
Select next elementAlt + Shift + .Ctrl + Shift + .
Select previous elementAlt + Shift + ,Ctrl + Shift + ,

How to Duplicate a Line in NetBeans

To duplicate a line in NetBeans, press Ctrl + Shift + Up or Ctrl + Shift + Down on Windows and Linux, or Alt + Shift + Up / Down on Mac. The duplicated line appears directly above or below the original, depending on the direction you choose. You can also select multiple lines first to duplicate an entire block.

How to Comment and Uncomment Code in NetBeans

To comment or uncomment code in NetBeans, select the lines and press Ctrl + / (⌘ + / on Mac). This shortcut toggles comments on and off, so pressing it again uncomments the selected lines. It works for single-line and multi-line selections in Java, PHP, and JavaScript files.

How to Format Code in NetBeans

To auto-format code in NetBeans, press Alt + Shift + F. This reindents and cleans up the entire file according to your formatting settings, or only the selected block if you highlight code first. You can adjust formatting rules under Tools → Options → Editor → Formatting.

Debugging Shortcuts

ActionWindows / LinuxMac
Run main projectF6F6
Run current fileShift + F6Shift + F6
Start debugging main projectCtrl + F5⌘ + F5
Debug current fileCtrl + Shift + F5⌘ + Shift + F5
Debug test for fileCtrl + Shift + F6⌘ + Shift + F6
Stop debuggingShift + F5Shift + F5
ContinueF5F5
Run to cursorF4F4
Step intoF7F7
Step overF8F8
Step outCtrl + F7⌘ + F7
Go to calling methodCtrl + Alt + Down⌘ + Option + Down
Evaluate expressionCtrl + F9⌘ + F9
Toggle breakpointCtrl + F8⌘ + F8
New breakpointCtrl + Shift + F8⌘ + Shift + F8
New watchCtrl + Shift + F7⌘ + Shift + F7

Refactoring Shortcuts

ActionWindows / LinuxMac
RenameCtrl + RCtrl + R
Find usagesAlt + F7Ctrl + F7
Inspect hierarchyAlt + F12Ctrl + F12
Surround withAlt + EnterCtrl + Enter
Extract methodCtrl + Shift + MCtrl + Shift + M
Extract local variableAlt + Shift + VCtrl + Shift + V
Extract fieldAlt + Shift + ECtrl + Shift + E

Window & File Management Shortcuts

ActionWindows / LinuxMac
New fileCtrl + N⌘ + N
New projectCtrl + Shift + N⌘ + Shift + N
Open fileCtrl + O⌘ + O
SaveCtrl + S⌘ + S
Save allCtrl + Shift + S⌘ + Shift + S
Close window/tabCtrl + W⌘ + W
Close allCtrl + Shift + W⌘ + Shift + W
Switch to recent fileCtrl + Tab⌘ + `
Maximize window (toggle)Shift + EscapeShift + Escape
Zoom text inAlt + Mouse Wheel Up⌘ + Mouse Wheel Up
Zoom text outAlt + Mouse Wheel Down⌘ + Mouse Wheel Down

Code Completion & Help (OS-independent) Shortcuts

ActionShortcut
Complete codeCtrl + Space
Show documentation popupCtrl + Shift + Space (or Javadoc: Ctrl + Shift + I)
Insert next matching wordCtrl + K
Show parameter hintsCtrl + P
Show suggestions / hintsAlt + Enter

Java & JSP Code Templates (type abbreviation + Tab OS-independent)

AbbreviationExpands to
soutSystem.out.println(“”)
serrSystem.err.println(“”)
psvmpublic static void main(String[] args) {}
psfpublic static final
psfspublic static final String
psfipublic static final int
fcomfor (Object elem : iterable) {}
forifor (int i = 0; i < arr.length; i++) {}
forlfor (int i = 0; i < list.size(); i++) {}
forstfor (StringTokenizer st = …)
iffif (condition) {}
ifelseif (condition) {} else {}
trycatchtry {} catch (Exception e) {}
whilelnwhile (condition) {}
dowhiledo {} while (condition);
instif (x instanceof Type t) {}
pstPreparedStatement
rsResultSet
Psf…(variants for protected/private static final)
stcdstatic class declaration
enenum
eqequals() override stub

How to Customize Keyboard Shortcuts in NetBeans

You can remap any NetBeans shortcut to fit your workflow, or switch to an Eclipse, IntelliJ, or Emacs keymap if you’re coming from another IDE.

  1. Open Tools → Options (NetBeans → Preferences on Mac).
  2. Click the Keymap tab.
  3. Use the Profile dropdown to choose a preset keymap (NetBeans, Eclipse, IntelliJ IDEA, or NetBeans 5.5).
  4. Search for an action by name, or search by pressing a key combination to see what’s assigned to it.
  5. Double-click the shortcut field and press your new key combination.
  6. Click OK to save. The new shortcut takes effect immediately and appears in the menus.

NetBeans vs IntelliJ vs Eclipse Shortcuts

ActionNetBeansIntelliJ IDEAEclipse
Duplicate lineCtrl + Shift + Up/DownCtrl + DCtrl + Alt + Up/Down
Comment lineCtrl + /Ctrl + /Ctrl + /
Format codeAlt + Shift + FCtrl + Alt + LCtrl + Shift + F
Go to declarationCtrl + BCtrl + BF3
Find usagesAlt + F7Alt + F7Ctrl + Shift + G
Rename / refactorCtrl + RShift + F6Alt + Shift + R
RunF6Shift + F10Ctrl + F11

If you’re switching to NetBeans from another IDE, you don’t have to relearn everything NetBeans lets you load an Eclipse or IntelliJ keymap directly from the Keymap settings.

Frequently Asked Questions

What is the shortcut to duplicate a line in NetBeans?

Press Ctrl + Shift + Up or Ctrl + Shift + Down on Windows and Linux, or Alt + Shift + Up/Down on Mac. The line is copied directly above or below the original.

How do I comment out code in NetBeans?

Select the lines and press Ctrl + / (⌘ + / on Mac). This toggles comments on and off pressing it again uncomments the lines.

How do I format code in NetBeans?

Press Alt + Shift + F to reformat the whole file, or highlight a block first to format only that selection.

How do I run a project in NetBeans?

Press F6 to run the main project, or Shift + F6 to run the current file. Use Ctrl + F5 to start debugging.

What is the shortcut to find usages in NetBeans?

Press Alt + F7 (Ctrl + F7 on Mac) to find every place a variable, method, or class is used across your project.

How do I change keyboard shortcuts in NetBeans?

Go to Tools → Options → Keymap (NetBeans → Preferences on Mac), search for the action, double-click the shortcut field, and press your new key combination.

Are NetBeans shortcuts different on Mac?

Mostly the Ctrl key becomes ⌘ (Command), but several shortcuts keep Ctrl and a few swap Ctrl/Alt for example, line duplication uses Alt + Shift + Up/Down on Mac instead of Ctrl + Shift.

Can I use Eclipse or IntelliJ shortcuts in NetBeans?

Yes. In Tools → Options → Keymap, change the Profile dropdown to Eclipse or IntelliJ IDEA to load that IDE’s shortcut scheme.

Mastering NetBeans Shortcuts

Learning even ten of these NetBeans shortcuts will noticeably speed up how you write, navigate, and debug code and once they’re in muscle memory, you’ll use them without thinking. Start with the everyday ones (duplicate line, comment, format, and Go to declaration), then add debugging and refactoring shortcuts as they come up in your workflow. Because NetBeans uses the same keymap across Windows, Linux, and macOS, the habits you build transfer to any machine, and you can always remap any command under Tools → Options → Keymap.

READ NEXT:

Pratik

Pratik is the founder of Tutorial Tactic and a productivity tools specialist with 15 years of hands-on experience in Google Workspace, Microsoft Office, and software automation. He has published over 1,500 guides on keyboard shortcuts, software commands, how-to tutorials and workflow optimization, helping readers across the US and India work faster with the tools they use every day. Tutorial Tactic was founded in 2021 with one goal: cut through the noise and give readers exactly what they need fast, verified, and beginner-friendly.
Back to top button