About this tool
A real-time, browser-based PHP formatting and beautification utility to clean and standardize your PHP code safely.
PHP Beautifier Studio reformats PHP source in the browser using Prettier with the official @prettier/plugin-php parser, so the output follows the same deterministic rules a Prettier-based CI check would apply. You control indent width (2, 4 or 8 spaces), print width (80, 120 or 160 characters), single versus double quotes and brace placement, and the formatted file can be copied or downloaded as formatted.php. If a snippet has a syntax error that Prettier refuses to parse, a built-in brace-and-semicolon fallback still re-indents it and tells you why, instead of returning nothing.
Open PHP Beautifier Studio on AltFTool — it loads instantly in your browser.
Paste code into the PHP Input Editor, or press Upload .php to load a file from disk.
Set Indent (2, 4 or 8 spaces), Print Width (80, 120 or 160 chars), Quotes and Brace Style (1TBS, Perl or Allman); the output reformats as you type.
Read the Beautified Output with its original and formatted byte sizes, then press Copy or Download to save formatted.php.
Formatting goes through the actual @prettier/plugin-php parser, so line breaking, argument wrapping and operator placement match what Prettier produces in a project's own toolchain.
When the parser rejects the input, a fallback pass re-indents on braces and semicolons — string- and escape-aware, so quotes are not split — and shows the parser's error message alongside the result.
Indent width, print width, quote style and brace style are the options teams argue about; each is a direct control here, and the byte size before and after is reported for the result.
Prettier standalone with the @prettier/plugin-php plugin, both loaded into the page and reused across passes. That means the output is byte-identical to running Prettier with the same options locally, which is what makes it safe to paste back into a repo governed by a Prettier check.
No. Formatting only rewrites whitespace, line breaks and quote style — the parsed program is the same. The one thing to be careful about is quote style, since switching a double-quoted string to single quotes stops variable interpolation; Prettier accounts for this and leaves interpolating strings alone.
1TBS keeps the opening brace on the same line as the statement everywhere, including classes and functions. PER-CS (PER Coding Style, formerly PSR-12, the widely used PHP standard) keeps the opening brace on the same line for control structures but moves it to its own new line for classes and functions.
No. Prettier and the PHP plugin run inside the page, so the source you paste is formatted locally and never uploaded — which matters when the file contains database credentials or an API key you have not stripped out yet.