More
More
Code Formatter & Minifier
Format or minify HTML, CSS, JavaScript, SQL, XML and YAML.
Free. Runs in your browser: nothing you enter or open is uploaded.
Everything runs in your browser. HTML, CSS and JavaScript are formatted with js-beautify (MIT licence), JavaScript is minified with Terser (BSD licence), SQL is formatted with sql-formatter (MIT) and YAML with js-yaml (MIT); the minifiers for HTML, CSS and SQL and the XML formatter are small scripts on this page. Each library loads only when you first use it.
How to use it
- Pick the language tab and paste your code, or open a file.
- Press Format for readable, indented code, or Minify for the smallest version. Choose the indent, and for SQL the dialect and keyword case.
- Copy the result or download it as a file.
Questions
Is minified code safe to use in production?
JavaScript is minified by Terser, the same engine most build tools use, so it is reliable. The HTML minifier is cautious: it removes comments and spare spaces but keeps the content of pre, textarea, script and style elements as written. Test the page after minifying either way.
Why did my YAML comments disappear?
Formatting YAML means reading it into data and writing it out again, and comments are not part of the data. Keep a copy of the original if the comments matter.
Which SQL dialect should I choose?
The one your database uses. It matters for quoting, special operators and keywords: MySQL uses backticks for names, SQL Server uses square brackets and PostgreSQL has operators such as ::. Standard SQL suits simple queries.
Is my code uploaded?
No. Formatting and minifying happen in your browser, so private code and configuration never leave your device.