Text UtilitiesText FormattersFree Tool

PHP Formatter

Apply basic bracket-based indentation to PHP code — not a real parser, so complex code may not indent perfectly.

How to Use PHP Formatter
  1. 1Paste your PHP code
  2. 2Click Convert
  3. 3Copy the re-indented output — verify against PHP-CS-Fixer for anything beyond simple code
Frequently Asked Questions

It counts opening ({, [, () and closing (}, ], )) brackets per line and adjusts indentation depth accordingly — a simple heuristic, not a real PHP parser.

Not specially — PHP open/close tags aren't recognized, and files mixing HTML and PHP may not indent sensibly since the heuristic only tracks generic brackets.

PHP-CS-Fixer or PHP_CodeSniffer — both use a real PHP parser and support configurable style standards (like PSR-12).

No — the indentation pass runs entirely in your browser.

Related Tools

Related Articles

More from Text Utilities