Skip to content

Format code

You can reformat:

  • A block of code in a source file.
  • Whole source files.
  • All the source files in a directory or in a project module.

More information about reformatting code in the IntelliJ IDEA documentation.

Reformat a block of code

  1. In the editor, select the block you want to reformat.
  2. Select Code > Reformat Code on the main menu.

Reformat all the source files in a directory or project module

  1. In the Project tool window, right-click a module or a directory and select Reformat Code.
  2. In Reformat Code, select the options you need and then Run.

Configuration settings

To manage reformat configuration settings, select File > Settings > Editor > Code Style on the main menu.