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
| Action | Windows / Linux | Mac |
|---|---|---|
| Go to type | Ctrl + O | ⌘ + O |
| Go to file | Alt + Shift + O | ⌘ + Shift + O |
| Go to declaration | Ctrl + B | ⌘ + B |
| Go to source | Ctrl + Shift + B | ⌘ + Shift + B |
| Go to line | Ctrl + G | Ctrl + G |
| Go to last edit | Ctrl + Q | ⌘ + Q |
| Go to Unit test | Ctrl + Shift + T | ⌘ + Shift + T |
| Copy file path | Alt + Shift + L | ⌘ + Shift + L |
| Toggle bookmark | Ctrl + Shift + M | ⌘ + Shift + M |
| Next bookmark | Ctrl + Shift + . | ⌘ + Shift + . |
| Previous bookmark | Ctrl + Shift + , | ⌘ + Shift + , |
| Next compile error | Ctrl + . | ⌘ + . |
| Previous compile error | Ctrl + , | ⌘ + , |
| Move caret to matching bracket | Ctrl + [ | ⌘ + [ |
| Go backward | Alt + Left | ⌘ + Left |
| Go forward | Alt + Right | ⌘ + Right |
| Select in Projects | Ctrl + Shift + 1 | ⌘ + Shift + 1 |
| Select in Files | Ctrl + Shift + 2 | ⌘ + Shift + 2 |
| Select in Favorites | Ctrl + Shift + 3 | ⌘ + Shift + 3 |
| Jump to quick search | Ctrl + I | ⌘ + I |
Search & Navigation Shortcuts
| Action | Windows / Linux | Mac |
|---|---|---|
| Find in file | Ctrl + F | ⌘ + F |
| Find next | F3 | ⌘ + G |
| Find previous | Shift + F3 | ⌘ + Shift + G |
| Search word at caret | Ctrl + F3 | ⌘ + F3 |
| Next word match | Ctrl + K | ⌘ + K |
| Previous word match | Ctrl + Shift + K | ⌘ + Shift + K |
| Replace in file | Ctrl + H | ⌘ + R |
| Find in projects | Ctrl + Shift + F | ⌘ + Shift + F |
| Replace in projects | Ctrl + Shift + H | ⌘ + Shift + H |
| Find usages | Alt + F7 | Ctrl + F7 |
Text Editing Shortcuts
| Action | Windows / Linux | Mac |
|---|---|---|
| Duplicate line up | Ctrl + Shift + Up | Alt + Shift + Up |
| Duplicate line down | Ctrl + Shift + Down | Alt + Shift + Down |
| Move line up | Alt + Shift + Up | Ctrl + Shift + Up |
| Move line down | Alt + Shift + Down | Ctrl + Shift + Down |
| Shift line left | Alt + Shift + Left | Ctrl + Shift + Left |
| Shift line right | Alt + Shift + Right | Ctrl + Shift + Right |
| Delete current line | Ctrl + E | ⌘ + E |
| Comment / uncomment (toggle) | Ctrl + / | ⌘ + / |
| Comment lines | Ctrl + Shift + C | ⌘ + Shift + C |
| Format code / selection | Alt + Shift + F | Ctrl + Shift + F |
| Fix all imports | Ctrl + Shift + I | ⌘ + Shift + I |
| Fix selected import | Alt + Shift + I | Ctrl + Shift + I |
| Generate code | Alt + Insert | Ctrl + Enter |
| Paste formatted | Ctrl + Shift + V | ⌘ + Shift + V |
| Show clipboard history | Ctrl + Shift + D | ⌘ + Shift + D |
| Rectangular selection | Ctrl + Shift + R | ⌘ + Shift + R |
| Select identifier | Alt + Shift + J | Ctrl + Shift + J |
| Select next element | Alt + Shift + . | Ctrl + Shift + . |
| Select previous element | Alt + 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
| Action | Windows / Linux | Mac |
|---|---|---|
| Run main project | F6 | F6 |
| Run current file | Shift + F6 | Shift + F6 |
| Start debugging main project | Ctrl + F5 | ⌘ + F5 |
| Debug current file | Ctrl + Shift + F5 | ⌘ + Shift + F5 |
| Debug test for file | Ctrl + Shift + F6 | ⌘ + Shift + F6 |
| Stop debugging | Shift + F5 | Shift + F5 |
| Continue | F5 | F5 |
| Run to cursor | F4 | F4 |
| Step into | F7 | F7 |
| Step over | F8 | F8 |
| Step out | Ctrl + F7 | ⌘ + F7 |
| Go to calling method | Ctrl + Alt + Down | ⌘ + Option + Down |
| Evaluate expression | Ctrl + F9 | ⌘ + F9 |
| Toggle breakpoint | Ctrl + F8 | ⌘ + F8 |
| New breakpoint | Ctrl + Shift + F8 | ⌘ + Shift + F8 |
| New watch | Ctrl + Shift + F7 | ⌘ + Shift + F7 |
Refactoring Shortcuts
| Action | Windows / Linux | Mac |
|---|---|---|
| Rename | Ctrl + R | Ctrl + R |
| Find usages | Alt + F7 | Ctrl + F7 |
| Inspect hierarchy | Alt + F12 | Ctrl + F12 |
| Surround with | Alt + Enter | Ctrl + Enter |
| Extract method | Ctrl + Shift + M | Ctrl + Shift + M |
| Extract local variable | Alt + Shift + V | Ctrl + Shift + V |
| Extract field | Alt + Shift + E | Ctrl + Shift + E |
Window & File Management Shortcuts
| Action | Windows / Linux | Mac |
|---|---|---|
| New file | Ctrl + N | ⌘ + N |
| New project | Ctrl + Shift + N | ⌘ + Shift + N |
| Open file | Ctrl + O | ⌘ + O |
| Save | Ctrl + S | ⌘ + S |
| Save all | Ctrl + Shift + S | ⌘ + Shift + S |
| Close window/tab | Ctrl + W | ⌘ + W |
| Close all | Ctrl + Shift + W | ⌘ + Shift + W |
| Switch to recent file | Ctrl + Tab | ⌘ + ` |
| Maximize window (toggle) | Shift + Escape | Shift + Escape |
| Zoom text in | Alt + Mouse Wheel Up | ⌘ + Mouse Wheel Up |
| Zoom text out | Alt + Mouse Wheel Down | ⌘ + Mouse Wheel Down |
Code Completion & Help (OS-independent) Shortcuts
| Action | Shortcut |
|---|---|
| Complete code | Ctrl + Space |
| Show documentation popup | Ctrl + Shift + Space (or Javadoc: Ctrl + Shift + I) |
| Insert next matching word | Ctrl + K |
| Show parameter hints | Ctrl + P |
| Show suggestions / hints | Alt + Enter |
Java & JSP Code Templates (type abbreviation + Tab OS-independent)
| Abbreviation | Expands to |
|---|---|
| sout | System.out.println(“”) |
| serr | System.err.println(“”) |
| psvm | public static void main(String[] args) {} |
| psf | public static final |
| psfs | public static final String |
| psfi | public static final int |
| fcom | for (Object elem : iterable) {} |
| fori | for (int i = 0; i < arr.length; i++) {} |
| forl | for (int i = 0; i < list.size(); i++) {} |
| forst | for (StringTokenizer st = …) |
| iff | if (condition) {} |
| ifelse | if (condition) {} else {} |
| trycatch | try {} catch (Exception e) {} |
| whileln | while (condition) {} |
| dowhile | do {} while (condition); |
| inst | if (x instanceof Type t) {} |
| pst | PreparedStatement |
| rs | ResultSet |
| Psf… | (variants for protected/private static final) |
| stcd | static class declaration |
| en | enum |
| eq | equals() 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.
- Open Tools → Options (NetBeans → Preferences on Mac).
- Click the Keymap tab.
- Use the Profile dropdown to choose a preset keymap (NetBeans, Eclipse, IntelliJ IDEA, or NetBeans 5.5).
- Search for an action by name, or search by pressing a key combination to see what’s assigned to it.
- Double-click the shortcut field and press your new key combination.
- Click OK to save. The new shortcut takes effect immediately and appears in the menus.
NetBeans vs IntelliJ vs Eclipse Shortcuts
| Action | NetBeans | IntelliJ IDEA | Eclipse |
|---|---|---|---|
| Duplicate line | Ctrl + Shift + Up/Down | Ctrl + D | Ctrl + Alt + Up/Down |
| Comment line | Ctrl + / | Ctrl + / | Ctrl + / |
| Format code | Alt + Shift + F | Ctrl + Alt + L | Ctrl + Shift + F |
| Go to declaration | Ctrl + B | Ctrl + B | F3 |
| Find usages | Alt + F7 | Alt + F7 | Ctrl + Shift + G |
| Rename / refactor | Ctrl + R | Shift + F6 | Alt + Shift + R |
| Run | F6 | Shift + F10 | Ctrl + 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:





