tools/java/java formatter
// javanew

java formatter

format java code with google-java-format — google or aosp style

// about this tool

Java formatter runs your code through google-java-format on our servers — the same formatter used by Google, the Android Open Source Project, and most major Java projects. Choose Google style (2-space indent, strict column limit) or AOSP style (4-space indent, wider lines). The output is syntax-highlighted so you can review it before copying back.

// when to use

  • Format a code snippet before pasting it into a PR comment or design doc
  • Normalize indentation and brace style when merging code from different contributors
  • Quickly check whether your IDE formatter is misconfigured by comparing its output
  • Format generated code (from JSON→Java or protobuf output) before committing

// faq

What is the difference between Google style and AOSP style?
Both are defined by google-java-format. Google style uses 2-space indentation and a 100-column line limit. AOSP (Android Open Source Project) style uses 4-space indentation and a 100-column line limit. If you are working on Android code, choose AOSP; otherwise Google style is the default.
Why does this require a Pro plan?
google-java-format is a JVM tool — it cannot run in a browser. The code is sent to our server, formatted in memory, and returned. The code is never stored or logged.
// history
Pro Cloud Sync — upgrade
no operations yet