Which brace style does Java use — K&R or Allman?
Java idiomatic style is K&R (also called Egyptian or 1TBS): the opening brace stays on the same line as the declaration. This is the convention in Oracle Java Code Conventions, Google Java Style, the JDK source, and Effective Java. Allman braces are uncommon in Java and most static analysis tools flag them. The formatter applies K&R by default.
What is the difference between Google Java Style and Sun/Oracle conventions?
Two main differences: indentation (Google uses 2 spaces, Oracle uses 4) and column limit (Google limits to 100, Oracle to 80). Google Java Style also enforces alphabetical import order and forbids wildcard imports. The formatter defaults to 4-space Oracle indentation but works with both — what matters is that you pick one and stay consistent across a codebase.
How should imports be grouped?
Oracle convention: java.* first, then javax.*, then org.*, then com.*, with a blank line between groups. Google Java Style: a single block sorted alphabetically with no grouping (except static imports above non-static). IntelliJ defaults follow Oracle; google-java-format applies Google style. Pick the convention that matches your build tool and configure your editor accordingly.
Does formatting Java change compiled bytecode?
No. Java is whitespace-insensitive outside of string literals (and text blocks, which preserve their interior whitespace deliberately). The compiler produces byte-identical .class files from formatted and unformatted source.
How are lambdas and method references formatted?
Single-expression lambdas stay on one line: list.stream().map(x -> x.name()). Multi-statement lambdas use a block with K&R braces and the body indented one level. Method references (Order::amount) and chained streams break onto multiple lines when the chain exceeds the column limit, with each operator starting a new line aligned under the source.
Is the Java code I paste sent to your servers?
No. Formatting runs entirely in your browser using JavaScript. Code containing JDBC URLs, API tokens, proprietary algorithms, or internal package names never leaves your device. Open DevTools → Network and click Format to verify.
Does it format records, sealed classes, and pattern matching?
Yes. Java 14 records, Java 17 sealed interfaces and classes, Java 21 pattern matching for switch, and record deconstruction patterns are all formatted with K&R braces and standard indentation. Text blocks (""" ... """) preserve their interior content exactly.
How is this different from google-java-format or Spotless?
google-java-format is a CLI/library that re-prints the AST and enforces Google Java Style strictly — no configuration. Spotless is a Gradle/Maven plugin that wraps multiple formatters (google-java-format, Eclipse JDT, Palantir) and runs them in CI. This online tool is lighter: it normalises indentation and braces only, ideal for snippets pasted from Stack Overflow or generated code where you do not want full project rules applied.