PHP Formatter
Format PHP source with consistent indentation. Free, private and instant — nothing is uploaded.
Input
Output
Ready
Drop a file to load it
About this tool
Format PHP source with consistent indentation. The formatter is token-aware: strings, template literals, regular expressions and comments are recognised and never reformatted internally, which is where naive formatters corrupt code.
When you would use it
- Reading minified or bundled source while debugging
- Normalising indentation in a file that has been edited by several tools
- Making an unfamiliar snippet readable before working with it
Worked example
function f(x){if(x>1){return x/2}else{return x*2}}
function f(x) {
if (x > 1) {
return x / 2
} else {
return x * 2
}
}
Things worth knowing
- Regular expression literals are distinguished from division, so
a / band/ab+c/gare both handled correctly. - Template literals — including nested
${...}expressions — are preserved exactly. - This reformats rather than rewrites: no code is removed, reordered or transformed.
Questions
Frequently asked
Does this change my code?
Only whitespace. No statements are rewritten, reordered or removed — it is a reformatter, not a transpiler or a linter.
Can it handle minified bundles?
Yes. Reformatting a bundle makes it readable, though minified code has already lost its original variable names — those cannot be recovered.
Is my data uploaded anywhere?
No. Every tool on JSONWorks runs entirely in your browser using JavaScript. Your input is never sent to a server, never logged and never stored. The simplest proof is to disconnect from the internet — the tools keep working. The site does load Google Fonts and a Google Analytics page-view tag, so you will see those two requests in your network tab, but neither receives anything you type or paste.
Related