Tools Hub

JSON, HTML, CSS, JavaScript, or SQL: which formatter?

Pick the formatter by language and know which ones parse safely, which keep licenses, and which never execute code.

Formatters look interchangeable until a document fails to parse. Each language has its own rules, and the safe tools state what they do with scripts, licenses and execution; choosing by file extension rather than by language is how a formatter mangles valid input.

Data and markup: JSON, HTML and XML

The JSON formatter validates and pretty-prints with line-precise errors, while the HTML formatter indents or minifies and keeps scripts verbatim. XML formatting validates structure as it indents, so a successful pass is also a parse check.

Styles and scripts: CSS and JavaScript

The CSS formatter indents tangled stylesheets or minifies them while keeping license comments intact. The JavaScript formatter parses code and never executes it, running in a worker so a large file does not freeze the page.

Queries: SQL by dialect

The SQL formatter understands dialect, keyword case and indent options, so the same query can be laid out for the engine you actually use. Use it for readability and review, not as a validator of query semantics.

Tools covered in this guide

Frequently asked questions about code formatters

Does formatting JavaScript execute the code?

No. The formatter parses the source without running it, which is why it can format untrusted snippets safely in the browser.

Will minifying CSS remove my license comment?

The minifier keeps license comments intact by design. Verify the output if your license requires an exact header.

Can a formatter fix invalid SQL?

No. It reformats queries; it does not repair syntax or verify that tables and columns exist.

More guides