Z

PHP Formatter

Reformat PHP source in your browser. PSR-12-friendly defaults, brace-style toggle, opener normalization.

Free No signup Client-side Privacy friendly

How to use

  1. 1 Paste PHP source.
  2. 2 Pick brace style and indent size.
  3. 3 Toggle whether to normalize short opening tags.
  4. 4 Copy or download the result.

Why use this tool

  • No client-side PHP parser exists — this is a rule-based reformatter that handles braces and indent reliably.
  • PSR-12 friendly defaults: K&R braces, 4-space indent.
  • Pure client-side — your code never leaves the browser.
  • For an authoritative format, run <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">vendor/bin/pint</code> or <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">php-cs-fixer</code> locally.

Frequently asked questions

Is this PSR-12 compliant?

It produces output close to PSR-12 (K&R braces, 4-space indent) but does not enforce every rule — line wrapping, import order, and method-spacing rules are not applied. For full PSR-12 use Pint or PHP-CS-Fixer.

Will it touch my HTML in templates?

It only reindents lines that contain PHP. Mixed HTML/PHP files may lose indentation inside the HTML sections — use a Blade-aware formatter for templates.

Looking for an HTML formatter?

Yes — see our <a href="/html-formatter" class="underline">HTML Formatter</a>.

Summary

PHP Formatter is a free developer utility by Zerethon Tools. Reformat PHP source in your browser. PSR-12-friendly defaults, brace-style toggle, opener normalization. Runs entirely in the browser — no signup, no upload.

Category
Developer
Pricing
Free
Privacy
Browser-based
Signup
Not required

Privacy

Your data never leaves your browser unless explicitly stated. PHP Formatter runs entirely client-side — no server upload, no logging, no tracking of your input.

Related tools

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Try Zerethon free