Code Formatters & Beautifiers
Minified or badly indented code is hard to read, review and debug. A formatter takes a wall of JSON, HTML or CSS and lays it out with consistent indentation and line breaks, so you can see the structure at a glance. The same tools also work in reverse: minify a file to strip whitespace and comments before it ships.
Every formatter here validates while it formats. For example, paste invalid JSON and you get the exact position of the error instead of a silent failure. Choose two spaces, four spaces or tabs to match your project's style guide, and use the line numbers to find the problem. The SCSS compiler goes one step further and turns Sass syntax (variables, nesting, mixins) into plain CSS the browser can use.
The minifiers go the other way. The JSON minifier strips whitespace and validates in the same pass. The CSS minifier removes comments and redundant characters without touching your selectors. The JavaScript minifier runs Terser, the same compressor most bundlers use. Each one shows the size before and after, so you can see whether the step was worth it.
All processing happens in your browser tab. That makes these tools safe for API responses that contain tokens, customer data or anything else you would not paste into a third-party server.
-
JSON Formatter
Beautify, validate and minify JSON.
-
HTML Formatter
Beautify or minify HTML with your choice of indentation.
-
CSS Formatter
Beautify or minify CSS with your choice of indentation.
-
SCSS to CSS Compiler
Compile SCSS to plain CSS.
-
JSON Minifier
Strip whitespace from JSON to shrink it.
-
CSS Minifier
Compress CSS by removing whitespace and comments.
-
JavaScript Minifier
Minify JavaScript with Terser in your browser.
-
SQL Formatter
Format and indent SQL queries.
-
XML Formatter
Beautify, minify and validate XML.
-
YAML Formatter & Validator
Validate, tidy and re-indent YAML.
Which tool for which job
-
Read a minified API response
JSON Formatter. Invalid JSON gets an error with its position, so you can find the stray comma or missing quote.
-
Shrink JSON before storing it in a column or an environment variable
JSON Minifier. The input is validated in the same pass, so a broken value never reaches storage.
-
Review a long query copied from a log or an ORM
SQL Formatter. With each clause on its own line, a missing JOIN condition or a misplaced OR is much easier to spot.
-
Clean up HTML exported from a CMS or an email builder
HTML Formatter. Re-indent the markup to read it, or minify it when size matters more than readability.
-
Read a production stylesheet that was minified
CSS Formatter. Each declaration goes on its own line, so you can search for a selector and read its rules.
-
Make a stylesheet smaller without a build step
CSS Minifier. Comments and whitespace are removed and your selectors are left as written.
-
Minify a script for a page that has no bundler
JavaScript Minifier. It runs Terser, the compressor webpack uses for production builds, and shows the size before and after.
-
Use Sass variables and nesting without installing anything
SCSS to CSS Compiler. The output is plain CSS you can paste into a stylesheet or a style tag.
-
Check an XML payload, feed or sitemap for errors
XML Formatter. It validates while it formats, so an unclosed tag or a bare & is reported as an error.
-
Find out why a YAML file will not load
YAML Formatter & Validator. The validator points to the first error. In YAML that is often a tab used for indentation, which the format does not allow.