Skip to content

PHP Developer Suite · free · no sign-up

PHP Formatter

Format PHP code with consistent indentation.

How it works Report a problem

PHP Formatter

Standardize and clean your PHP code blocks

PHP Tool
PHP Script
Formatted Output

                

About the PHP Formatter

Format PHP code with consistent indentation.

How to use the PHP Formatter

  1. Paste your code into the input box, or click Load Sample to load an example.
  2. Choose 4 Spaces (PSR-12) or 2 Spaces for the Indentation.
  3. Press Format PHP Code.
  4. Use Copy (or Download where shown) to keep the result. Clear empties the box.

Tips

  • Use the same formatting across your whole project.

Frequently asked questions

Which indentation is standard in PHP?
Four spaces, as set out in PSR-12.