PHP copied from a forum or an old file arrives as one long line and a headache. This beautifier re-formats it to clean PSR-12 in your browser, with your choice of indent and brace style, and the code never leaves your device.
Your files are processed in your browser, on your own device. Nothing is uploaded to a server.
Unformatted PHP is a tax on everyone who reads it after you, and most PHP in the wild was formatted by nobody: copied from a forum, generated by a template, or written at 2 a.m. against a deadline. This php beautifier re-formats pasted PHP to clean, consistent PSR-12 style right in your browser – real parsing, real syntax errors reported honestly, with indent width and brace style under your control. The formatter is the Prettier engine with its PHP plugin, loaded onto this page. Your code is never uploaded, which for client work and unreleased projects is the whole point.
Whitespace and layout, nothing else. Indentation is rebuilt from the structure of the code, braces move to the chosen style, spacing around operators and after commas is normalised, and long lines are arranged the way the standard prescribes. Your logic, your variable names, your comments and your strings come out untouched, character for character where it counts. That boundary matters: a formatter you cannot trust to leave meaning alone is a refactoring tool wearing the wrong badge, and this one is deliberately only a formatter. It is the same engine, Prettier with the PHP plugin, that development teams run inside their editors, loaded here as a web page.
PSR-12 is the PHP-FIG coding style standard most of the PHP world now shares: four-space indents, braces for classes and methods on their own line, one space after commas, visibility declared on every property and method, and a handful of other agreements that make any file feel familiar to any PHP reader. Formatting to a shared standard is not tidiness for its own sake. It removes the layout argument from code review, makes diffs show real changes instead of indentation noise, and means the next reader spends attention on what the code does. The options here exist because standards bend to house style – but they bend between two named styles, not into mush. Companion tools for the same desk work sit under Developer Tools, including the JSON Formatter and the HTML Formatter built on the same engine family.
Online beautifiers usually work by uploading your code to a stranger’s server, which for a quick public snippet is fine and for a client’s codebase is a policy violation with extra steps. This page loads the formatting engine itself – about a quarter of a megabyte of JavaScript – and after that the code you paste travels nowhere. Close the tab and it is gone. The trade-off is honesty-sized: a full parser in a browser tab handles files of a few thousand lines comfortably, and very large generated files are better formatted locally in your editor with the same engine. For the daily case – a function, a template, a copied example – the browser is the right place.
No. The formatter changes whitespace and layout only: indentation, brace placement, spacing. It does not rename, reorder or rewrite code, and the output runs exactly as the input ran. If the input has a syntax error, the formatter refuses and reports it rather than guessing, which protects you from a tool quietly altering broken code into different broken code.
PSR-12 is the shared coding style published by the PHP-FIG group, and it is the default expectation in modern PHP teams, frameworks and code review. Use it unless your project already follows a different written standard. The value is not the specific rules, it is that every file in a project follows the same ones. This tool defaults to PSR-12: four-space indent, braces on their own line for classes and functions.
Yes. Paste the snippet as it is and the tool adds the opening tag before parsing, then tells you in the stats line that it did, so nothing happens silently. The downloaded file includes the tag. If your snippet is a template mixing HTML and PHP, include the whole file: the parser handles mixed templates as PHP files.
Neither. The Prettier engine runs as JavaScript inside this page, and formatting happens on your device. ToolPeko’s server delivers the page and the engine once and never receives your code. That makes the page safe for client code, unreleased work and configuration files with values you would rather keep off other people’s servers.
Almost always a real syntax error: an unclosed brace, a missing semicolon, or a half-pasted function. The error panel names the problem area instead of formatting around it. Fix the code and paste it again. Very old PHP with short tags or code mixing several languages in one file can also trip the parser, and the honest answer there is a local editor with the same engine.
Nothing functional – PHP ignores indentation entirely. Four spaces is the PSR-12 standard and reads better in deeply nested code, which PHP templates often are. Two spaces suits teams coming from JavaScript or Ruby habits and keeps wide lines shorter. Pick the one your project uses everywhere. Consistency across a codebase beats either choice made file by file.
Same rules as this one: free, in your browser, with nothing uploaded.
Paste messy JSON, get it neat and valid.
Check JSON and find the exact line that breaks it.
Squeeze JSON down to one tight line.
Open JSON as a tree you can fold and explore.
JSON rows turned into a CSV a spreadsheet can open.
A CSV file turned into clean JSON objects.
JSON rewritten as YAML for config files.
YAML config turned into JSON you can use in code.