Back to Tools
PHP Formatter
PHP Formatter
Standardize and clean your PHP code blocks
PHP Tool
Formatted Output
About the PHP Formatter
Format PHP code with consistent indentation.
How to use the PHP Formatter
- Paste your code into the input box, or click Load Sample to load an example.
- Choose 4 Spaces (PSR-12) or 2 Spaces for the Indentation.
- Press Format PHP Code.
- 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.