PHP Beautifier
Paste compact or minified PHP and format it with proper indentation and readable brace placement.
Last updated: May 29, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is PHP Beautifier?
PHP Beautifier reformats PHP source code — including classes, methods, conditionals, and loops — so it is easy to read. It preserves <?php opening and ?> closing tags, handles $variables and -> method chains, and uses C-style brace formatting to indent code blocks. It is intentionally lightweight and focuses on indentation and line breaks rather than full AST parsing.
How to Use PHP Beautifier
Paste PHP source code.
Choose indentation style.
Click Format.
Review the beautified PHP output.
Copy or download the .php file.
Common Use Cases
- Expanding minified PHP from CMS templates or plugins.
- Normalizing indentation when merging PHP snippets from different sources.
- Formatting compact PHP examples before adding to documentation.
- Tidying legacy PHP scripts before refactoring.
Example Input and Output
A compact PHP class is expanded with proper indentation.
<?php
class Greeter{public function hello($name){return "Hello, ".$name;}}
?><?php
class Greeter {
public function hello($name) {
return "Hello, " . $name;
}
}
?>Privacy
PHP code is formatted locally in the browser and is not uploaded.

