Java Formatter — Reindent Java with K&R or Allman Braces
Reindent only — not a full formatterReindent Java source with K&R or Allman brace style. Pure client-side, no compile.
How to use
- 1 Paste Java source code.
- 2 Pick brace style and indent size.
- 3 Toggle Javadoc indent normalization if your comments have inconsistent alignment.
- 4 Copy or download the result.
Why use this tool
- Rule-based reformatter — no compile, no parser download.
- Both K&R (Oracle / Google style) and Allman supported.
- Pure client-side — code never leaves the browser.
- For full AST-level format use Google Java Format or IntelliJ formatter locally.
Frequently asked questions
Does this match Google Java Format?
Close, not identical — we apply indent + brace rules only. Google Java Format also wraps long lines and reorders imports. For canonical output, run the CLI.
Will annotations stay on their own line?
Yes — we never move annotations relative to the line they sit on. Add or remove blank lines manually.
Looking for a C# formatter?
Yes — see our <a href="/csharp-formatter" class="underline">C# Formatter</a> which uses the same rule engine with Allman default.
What is Java Formatter?
A Java Formatter is a tool that reindents Java source code in the browser using either K&R or Allman brace style. It applies consistent indentation and brace placement without compiling the code, running purely client-side so the source never leaves the user's device.
Features
Brace-depth reindent
Re-indents classes and methods by nesting and normalizes brace style to K&R or Allman.
Javadoc alignment
Aligns leading `*` in Javadoc comment blocks to a consistent column.
100% private
Runs on your device — your source is never uploaded.
Example
Input
public class A
{
int x = 1;
}
Output
public class A {
int x = 1;
}
Common use cases
-
1
Fix pasted Java
Repair indentation on code copied from a PDF, slide, or forum.
-
2
Normalize brace style
Switch a block between K&R and Allman placement.
-
3
Pre-review tidy
Improve layout before a code review without running a full formatter.
Zerethon's Java formatter reindents Java source in your browser by brace depth, normalizes brace placement (K&R or Allman), and aligns Javadoc `*` lines. It is a lightweight reindenter, not a full google-java-format — it tidies layout without reflowing statements. Nothing is uploaded.
- Category
- Developer
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
References
- Google Java Style Guide — Google
- The Java Language Specification — Oracle
Privacy
Your data never leaves your browser unless explicitly stated. Java Formatter runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
JSON Formatter
Format, validate, and minify JSON online. Free, no signup — your data never leaves your browser.
Open toolSQL Formatter
Format SQL queries online — beautify MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and BigQuery.
Open toolUUID Generator
Generate UUIDs online — v1, v4, v7, and Nil. Bulk generation up to 10,000. Free, no signup.
Open toolPassword Generator
Generate strong, cryptographically random passwords. Configurable length and character sets — runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.