Unminify PHP Code
Got PHP squeezed onto one line? This page expands it back into separate statements, with braces on their own lines and each block indented. Variable names are not restored, and comments that were removed are gone for good, but the structure becomes easy to follow.
How to unminify PHP
-
1
Paste the one-line code
Copy the compressed PHP into the PHP code box.
-
2
Choose the indent
Select 2 or 4 spaces. Four spaces is easier to scan for deep nesting.
-
3
Continue to the result
The expanded code appears on the next page.
-
4
Check and copy
Read through it, then copy it into your editor.
What unminifying can and cannot do
Minifiers remove whitespace and comments, and some also shorten names. Expanding the layout is the easy part: a statement ends at a semicolon, a block starts and ends at a brace. This tool uses exactly those markers. It cannot bring back removed comments, original variable names or original formatting choices.
Example
Compressed input:
<?php if($age>=18){echo "adult";}else{echo "minor";}
Expanded result:
<?php if($age>=18)
{
echo "adult";
}
else
{
echo "minor";
}
The tool also adds a space after each comma, so ["red","green"] becomes ["red", "green"]. This applies to commas in the code, not only between arguments.
Limits to keep in mind
- Strings that contain commas, such as
"a,b", also get a space added after the comma, because that rule runs over the whole text before the code is read. Check text literals afterwards. - A semicolon or brace inside a comment is treated as code and starts a new line there.
- Spacing around operators stays as it was. If the minified source wrote
$a+$b, the result does too. - Obfuscated code that uses encoded strings or evaluated payloads stays unreadable even when laid out neatly. Treat unknown code with care and never run it just to see what it does.
Reading the result
Start with the outermost braces, which are now at the left edge, and work inward. Function and class headers show what the code defines, and the indented lines under them show what each piece does. Long chains of statements that were run together are now one per line, so you can follow the order in which things happen.
Tips for working with compressed code
- Format first, then read. Do not edit the compressed text directly.
- Keep the original file. The expanded layout is for reading, and your editor’s formatter can restyle it later.
- If a file has several top-level functions, paste them together. Each ends at its closing brace, which makes the boundaries easy to see.
Compare against the original
If you still have the minified file, search it for a few unusual strings and confirm they appear in the expanded text. This is a quick way to confirm nothing was lost, and it is worth doing before you copy the result anywhere important.
Frequently Asked Questions
No. Names shortened by a minifier are lost. Only the layout is rebuilt.
No. Once comments are removed from the source, there is nothing to restore.
It should be for simple code, since only whitespace changes. Comma spacing inside string literals is the main exception, so check strings.
No. It only changes layout. Encoded or packed payloads stay as they are.
Related Tools
Color Wheel Explorer
Explore the colour wheel interactively. Rotate harmonies, compare HSL vs RYB, spot complementary and triadic pairs in real time.
FPS Counter
Measure browser FPS with requestAnimationFrame, smoothing, min/max frame rate, warnings and an optional graph. Runs locally with no upload or API.
Placeholder Image Generator
Create a 1–4000 px placeholder with custom colors and text, download it as PNG, or copy a URL and HTML image tag.
Random Phone Number Generator
Generate 1 to 50 fictional phone numbers from officially reserved ranges for the US, Canada, UK, Australia or Germany.
GitHub Profile README Generator
Build the README.md for your GitHub profile page (the username/username repo) with tagline, skills, stats cards and language breakdown.
Color Palette Generator
Generate monochromatic, analogous, complementary, triadic or tetradic color palettes from a base HEX color and export copy-ready CSS variables.
Tool available in other languages
- คลายการบีบอัดโค้ด PHP [TH]
- Rozminifikuj kod PHP [PL]
- Giải nén mã PHP [VI]
- Membuka Minify Kode PHP [ID]
- فك ضغط كود PHP [AR]
- PHP-Code entminifizieren [DE]
- PHP コードの圧縮を解除する [JA]
- Desminificar código PHP [PT]
- Desminificar código PHP [ES]
- PHP 코드 압축 풀기 [KO]
- Avminifiera PHP-kod [SV]
- Désminifier du code PHP [FR]
- PHP-code unminifyen [NL]
- Decomprimere codice PHP [IT]
- Распаковка кода PHP [RU]
- PHP Kodunu Minify Etmeden Geri Açın [TR]
- 还原压缩的 PHP 代码 [ZH]