How do I format code on this page?
Paste code into the left editor or load a file, choose the options you need, and select Format. Review the result on the right, then copy or save it.
Format Java classes, methods, records, interfaces, and pasted code snippets with consistent indentation, spacing, braces, and line breaks without renaming variables or changing program behavior.
Choose LLVM, Google, Chromium, Mozilla, WebKit, or GNU as the base style, then set an indent width from 1 to 16 spaces and a column limit up to 1000. A column limit of 0 disables line wrapping. You can load a .java file and copy or save the formatted output.
Paste code into the left editor or load a file, choose the options you need, and select Format. Review the result on the right, then copy or save it.
The input must match the selected language or syntax. Check incomplete statements, unmatched brackets or quotes, and a dialect or mode that does not match the input, then format again.
A code formatter reads language-aware tokens and nested structures, then rewrites indentation, spacing, and line breaks according to a consistent rule set. It does not compile or run the program, so formatting is not a correctness or security check.
Google Java style uses 2-space block indentation and a 100-column limit; use those values for new Google-style code. Choose LLVM, Google, Chromium, Mozilla, WebKit, or GNU style, then set the indent width and column limit for the Java output.