Three jobs people mix up
Beautify, minify, and validate pull in different directions. Running the wrong one produces a file that looks finished and still fails the next check.
Beautify
Rebuild indent, spacing, and blank lines. The PHP formatter is the right page for the sample above. Logic stays.
Minify
Strip the same whitespace so a browser or a size limit is happier. That work lives in the minifier set, not here. SVG is the exception on this shelf, because that page also minifies.
Check it
A pretty reprint of broken JSON is a lie. The universal formatter refuses JSON that does not parse. Risky patterns belong on the style checker.
Same function. Two printings.
Nothing in the arithmetic moved. $rate is still 0.2. The early return is still there. round() still takes two arguments. A missing amount key still warns at runtime, because a formatter does not invent keys.
Send that paste to the PHP formatter. The universal printer will indent it, then ignore PSR-12 brace rules. House style is the point of a language page.
- commasA space after each argument. The signature stops looking like one token.
- equalsSpaces around
=and around the operators in the sum. - bracesThe opening brace drops to its own line. Allman, which PSR-12 expects for functions.
- depthFour spaces per level. The cramped paste had none.
- blanksOne blank line between the guard and the loop. Not three.
Match the paste to the parser
Auto-detect on the universal formatter ranks a language and shows when the score is weak. Use it for a mystery snippet. Skip it when the file extension is already on the tab.
JSON, JavaScript, HTML, CSS, SQL, and YAML are not on this shelf. Each has its own beautifier: JSON, JavaScript, HTML, CSS, SQL, YAML.
Source files
Open the language page when you already know the file. Auto-detect is a score, and a PHP file with a SQL string inside it often loses.
- PHP PSR-12 shape, four spaces
- Python Indent is syntax here
- Java Brace style is a choice
- C# .NET indent, browser only
- C Warns when braces do not balance
- C++ Templates keep their depth
- TypeScript Same printer Prettier 3 uses
- Perl Skips POD, heredocs, __DATA__
- Ruby Two spaces. RuboCop still owns the repo
- Lua Keyword aware, quote options
UI markup
JSX and templates fail when a formatter treats them as HTML. Bindings, interpolation, and components have to stay intact.
Contracts and payloads
A pretty envelope is not a successful call. These pages reprint the document. They do not hit the endpoint.
Docs
Markdown spacing is part of the meaning. A heading jump or a missing image alt is a report, not a silent rewrite.
Two spaces, four spaces, or a tab
The fight is rarely about correctness. It is about whose printer runs last. Prettier's JavaScript default is two spaces. PSR-12 is four. PEP 8 is four, and a tab in the same block is a hard error. Paste into the style the file already uses.
| Language | Unit | What this site prints | Where people get burned |
|---|---|---|---|
| PHP | 4 spaces | PSR-12, brace on the next line | A 2-space reprint touches every line and changes no behavior |
| Python | 4 spaces | PEP 8 spacing, blank lines rebuilt | A mixed tab is a TabError, not a style nit |
| JavaScript / TypeScript | 2 spaces | Prettier defaults on the TypeScript page | Your repo .prettierrc wins over a paste box |
| Ruby | 2 spaces | end keywords paired, heredocs left alone | RuboCop still owns a real repository |
| GraphQL | 2 spaces | Commas are whitespace | A typo in a field name still prints cleanly |
| Java | 4 spaces | Attached or Allman, your pick | Import sorting is a real edit. Glance at it |
Reformatting a 4-space file down to 2 spaces is a commit someone will ask you to revert. Match the file. Leave the repo tool in charge of the repository.
Sitting on a snippet from a pull request? Open the language page, match the indent, copy the result back. A whole repo belongs in php-cs-fixer, Prettier, Black, or RuboCop.
Open the formatter shelfA paste box is a bad CI system
These pages are for a snippet a person needs to read. They are a poor place to enforce a style guide.
- No project, no config file. php-cs-fixer, Black, Ruff, Prettier, RuboCop, and clang-format see the repo and the settings in it. A browser tab sees the paste.
- GraphQL does not know your types. The GraphQL formatter reprints a legal document. A misspelled field still looks legal.
- Babel changes the program. The Babel page formats and transpiles. Transpile output is a different job from a beautifier. Read the result before you ship it.
- SVG edits the drawing. The SVG formatter drops editor metadata and rounds path coordinates when you ask. That is a content change. Look at the render beside the code.
- A raw API body is not clean JSON. The API response formatter handles headers, JSON Lines, XML, and YAML, and it points at the character a parse error came from. The universal page refuses invalid JSON outright.
- Markdown reports, it does not guess intent. The Markdown formatter aligns tables and flags heading jumps, duplicate anchors, and missing alt text. It will not invent the alt text.
After the diff looks huge
The diff is the entire file. Did the logic change?
Read one function. If names, operators, and literals match, you changed print style. A 2-space reprint of a 4-space file touches every line and leaves the interpreter with the same program. Python is the exception: there, the indent is the structure.
The GraphQL looks perfect and the server still rejects it.
The GraphQL formatter checks grammar. It never loads your schema. A field spelled usre is a legal name on the page and a failure at execution. Validate against the endpoint, or an editor that has introspection loaded.
Format first, or minify first?
Format while a person is reading. Minify when a browser or a payload limit is the audience. Putting both results in the same source file means the next reader opens the minified copy and formats it again. Keep the readable file in git.
Does the paste leave this browser?
No. These formatters run in the tab. A secret inside the snippet stays on your machine. Anyone looking at your screen still reads it, the same risk as a shared terminal.
The universal formatter picked the wrong language.
Detection is a ranked guess. Mixed files confuse it, and a weak score is the page telling you to stop trusting the guess. Open the language page when you know what you pasted.
Why does Python still look different from Black?
Black parses the file and prints a new tree, so it wraps arguments and rewrites quotes. The Python page on Toolexe rewrites spacing, indent, and blank lines line by line. For a repository under CI, install Black or Ruff. For a snippet from a chat thread, the page is the faster read.
When the layout is clean and the bug remains
Formatting made the file readable. It did not prove the file is right. JSON still needs a parse. A query still needs the schema. A style smell still needs a checker.
Print the file for a person to read. Leave the rewrite to a tool that parses.