# Formatting files or portions of code

To format Java code:

1. Use the Code Formatting Preferences page (Window > Preferences > Java > Code Formatter) to specify your preferences for code formatting.
2. Open a Java file and select the code you want to format. If nothing is selected, then all of the editor content is formatted.
3. Format the code by either
   - Selecting Source > Format from the editor's pop-up menu or
   - Pressing Ctrl+Shift+F or
   - Selecting Source > Format from the menu bar.

Java development tools (JDT)
Java editor

Using the Java editor
Formatting Java code
Setting code formatting preferences

Source menu
Code Formatter preferences