Calculator
What the Code Beautifier does
Code Beautifier: formats Status, Output and Bytes from JSON Input, Indent and Sort keys. Example: indent 2 spaces, sort keys Keep order and action Format gives status Formatted.
The Code Beautifier takes JSON Input, Indent, Sort keys and Action and returns Status, Output and Bytes. Edit a field and the answer updates in place.
Typical users are people inspecting an API response. Most of these tasks are one-liners in a terminal, but not when you are away from one.
Nothing leaves the tab. You can watch your browser network panel while you use it and see for yourself.
Further down the page: what each field expects, how the result is derived, and one example worked from the defaults.
What do the Code Beautifier fields mean?
The Code Beautifier uses 4 inputs. Each input has a default that makes sense on its own, so a partial edit still gives a valid result.
| Field | What to enter | Default |
|---|---|---|
| JSON Input | paste or type any amount of text | [ { "name": "YoursTools", "tools": 801, "categories": ["developer", "finance", "health"], "active": true }, { "name": "Demo App", "tools": 42, "categories": ["math", "converters"], "active": false } ] |
| Indent | choose from 2 spaces, 3 spaces, 4 spaces or Tab | 2 spaces |
| Sort keys | choose from Keep order or A to Z | Keep order |
| Action | choose from Format, Validate or Minify | Format |
How does the Code Beautifier work?
Each output is derived from the inputs above in a single pass; there is no hidden state carried between runs, so the same inputs always give the same formatted output.
Range checks come first, so the formula only ever sees values it can handle.
Worked example
These are the values the Code Beautifier loads by default, and the result it produces from them. Here is the calculation as it stands the moment the page loads.
| JSON Input | [ { "name": "YoursTools", "tools": 801, "ca… |
|---|---|
| Indent | 2 spaces |
| Sort keys | Keep order |
| Action | Format |
| Status | Formatted |
|---|---|
| Output | [ { "name": "YoursTools", "tools": 801, "categories": [ "developer", "finance"… |
| Bytes | 282 |
How to use it
- Paste your content into JSON Input.
- Pick a value for Indent: the options are 2 spaces, 3 spaces, 4 spaces or Tab.
- Pick a value for Sort keys: the options are Keep order or A to Z.
- Pick a value for Action: the options are Format, Validate or Minify.
- The tool reacts immediately rather than waiting for you to finish the form.
- The results panel then shows Status, Output and Bytes.
- Copy Link is the quickest way to send the exact scenario to someone else.
What this tool does not do
- Output follows the common convention for this format; a specific toolchain may have its own house style.
- Processing happens in your browser, so extremely large inputs are bounded by available memory.
- The output is a number, not a judgement. Deciding what it means is still your job.
Frequently asked questions
The form asks for JSON Input, Indent, Sort keys and Action. Nothing starts empty, which means a single edit is enough to get a meaningful answer.
With the values loaded when the page opens, status comes out as Formatted. Any edit re-runs the calculation, so there is no stale number on screen.
No. The parsing happens in your browser, so sensitive payloads never leave your machine.
Nothing at all. There is no registration, no paywall and no per-use quota.
Full double precision is used throughout; only the displayed figure is shortened.