Back to Tools

PHP Formatter

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

Four spaces, as set out in PSR-12.
Live Support
We usually reply within minutes

Enter your name to start a conversation with our team.