SQL Prettifier

Format tangled SQL into clean, readable statements.

Processed locally — nothing is uploaded

About Code Formatter

Useful for making a minified payload readable again, for checking that a config parses before you ship it, or for stripping a file down for production. Switching language keeps whatever you have already pasted.

Reformat a cramped or machine-generated SQL query into clean, consistently indented statements that are easy to read and review. Keywords, clauses and nesting are aligned in your browser, so proprietary queries never leave the page.

Paste messy or minified code and instantly beautify, minify or validate JSON, HTML, CSS, SQL, XML and YAML. Beautifying re-indents your source with consistent spacing so it is easy to read and review; minifying strips whitespace and comments to ship smaller files; validating surfaces syntax errors with the exact location so you can fix them fast.

It also doubles as a converter between common data formats — JSON to CSV, CSV to JSON, YAML to JSON and back — which is handy when wiring up APIs, configs or spreadsheets. Converting is where structure mismatches surface: CSV has no nesting, so a nested JSON object has to be flattened or dropped.

Learn how this works

Frequently asked questions

Which SQL dialects are supported?

Formatting is dialect-agnostic: it works on the shared shape of SQL — clauses, nesting and keywords — so it handles PostgreSQL, MySQL, SQL Server, SQLite and BigQuery alike. Dialect-specific functions are preserved as written rather than validated.

Does formatting change what my query does?

No. Only whitespace and line breaks change, so the parsed statement is identical. String literals and quoted identifiers are left untouched, including any that happen to contain SQL keywords.

Is it safe to paste a query containing table or column names?

Yes — formatting happens entirely in your browser and nothing is sent to a server, so proprietary schema names never leave your machine. Even so, strip real credentials or personal data out of literals before sharing the result.

Pro Tips

  • Paste unformatted JSON, HTML, CSS, or SQL code and apply consistent indentation (2, 4, or tab spaces) in one click.
  • Use minification toggle to reduce code size by 30-50% for production deployment or email constraints.
  • Export formatted code directly to clipboard to paste into documentation, emails, or config files instantly.
  • Compare formatted vs minified side-by-side to verify code compression doesn't break syntax.

Common Use Cases

  • Making an ORM-generated or machine-built query readable enough to review
  • Tidying a long query before pasting it into a pull request or a runbook
  • Untangling deeply nested subqueries to find where a join went wrong

How It Compares

While Prettier and VS Code extensions require installation and configuration, our web-based formatter works instantly on any device without setup, offering broader language support (HTML, CSS, SQL) in a single tool compared to language-specific formatters like Beautifier.io.

More Code Formatter tools

Related tools