Formatters
Format and beautify code — 5 free tools in our Developer Tools category.
All 5 tools
JSON Formatter
Format, validate, and beautify JSON data online. Free JSON formatter with syntax highlighting, error detection, and minify option.
JSON Minifier
Minify JSON by removing whitespace and formatting. Reduce file size instantly. Shows bytes saved. Free online JSON compressor.
SQL Formatter
Format and beautify SQL queries online. Supports MySQL, PostgreSQL, T-SQL, and standard SQL. Free SQL beautifier.
CSS Minifier
Minify CSS by removing comments, whitespace, and unnecessary characters. Reduce CSS file size instantly.
HTML Beautifier
Beautify and format HTML with proper indentation. Fix messy HTML into readable, well-structured code. Free online tool.
Formatting tools move code between two states: expanded, with the indentation and line breaks that make structure visible to a person, and minified, with all of that stripped out to reduce bytes. Both matter, at different points in the same workflow.
Beautify while you work, minify to ship
Reach for the JSON Formatter when an API response arrives as one unreadable line, or when you need to find the syntax error in a payload — it validates as it formats, and reports where the problem is. The SQL Formatter does the same job for queries, putting each clause and join on its own line, which is usually how you spot a missing join condition. The HTML Beautifier re-indents markup so mismatched nesting becomes obvious.
Going the other way, the JSON Minifier and CSS Minifier strip whitespace and comments for production.
How much minification actually saves
Less than the raw byte difference suggests. Minifying typically removes 10 to 30 percent of a JSON document and 20 to 35 percent of a stylesheet, but gzip and Brotli already collapse repeated whitespace very efficiently, so the saving measured over a compressed HTTP response is much smaller. Minification still reduces the bytes a browser must parse, which is the more durable argument for it.
Two practical rules. Keep the readable version as your source of truth in version control and minify as a build step, because minification is effectively one-way — comments are gone and formatting cannot be meaningfully recovered. And ship a source map alongside minified assets, or your browser's dev tools will report every rule as living on line 1.
Frequently Asked Questions
Does formatting or minifying change what my code does?▼
For JSON and SQL, no — only insignificant whitespace changes. For CSS and HTML there are edge cases: comment-based browser hacks stop working when comments are stripped, and whitespace is meaningful between inline HTML elements and inside `pre` and `textarea`, so re-indenting those can alter rendering.
Why does my JSON fail to parse when it looks fine?▼
The usual culprits are a trailing comma, single quotes instead of double, or an unquoted key — all legal in JavaScript and all invalid in JSON. Comments are also not part of the JSON specification; if you need them you are using JSONC or JSON5, not JSON.
What indentation should I use?▼
Two spaces is the common convention for JSON, HTML and most web code, and it keeps deeply nested structures from running off the screen. Four spaces suits shallower files. Tabs are the better choice for accessibility, since each reader can set their own display width.