Google Java Code Formatter for IntelliJ IDEA


Google Java Code Formatter is a tool that helps you format your Java code according to the Google Java Style Guide. If you want to configure it in IntelliJ IDEA, you can follow these steps:


  • Install Google Java Format Plugin:

    • Go to IntelliJ IDEA settings by pressing Ctrl + Alt + S (or Cmd + , on macOS).
    • Navigate to “Plugins” and search for “google-java-format.”
    • Install the plugin and restart IntelliJ IDEA.

  • Configure Code Style:

    • After installing the plugin, go to IntelliJ IDEA settings again.
    • Navigate to “Code Style” -> “Java.”

  • Import Google Style Settings:

    • Click on the “Manage” button next to the “Scheme” dropdown.
    • Choose “Import Scheme” -> “IntelliJ IDEA code style XML.”
    • Locate the Google Java Style XML file. You can find this file in the intellij-java-google-style GitHub repository (https://github.com/google/styleguide).

  • Apply Google Code Style:

    • Once you’ve imported the Google Java Style, select it from the “Scheme” dropdown.

  • (Optional) Configure Formatting on Save:

    • You can configure IntelliJ IDEA to format code automatically on save.

      • In the settings, navigate to “Code Style” -> “Java” -> “Other.”
      • Check the option “Reformat code on Save.”


Now, IntelliJ IDEA should format your Java code according to the Google Java Style when you save your files.


Keep in mind that it’s always a good idea to check the latest instructions and documentation for the Google Java Code Formatter and IntelliJ IDEA, as things might have changed after my last training data in January 2022.


Leave a Reply

Your email address will not be published. Required fields are marked *