ToolSink

SQL Query Beautifier

Beautify SQL queries with keyword casing, custom indent width and dialect-aware formatting.

What is the SQL Query Beautifier?

The SQL Query Beautifier is a companion to the SQL Formatter with more granular controls. Beyond basic pretty-printing, it lets you set dialect-specific rules, apply case conventions to keywords, functions and identifiers, and choose whether to expand or keep short queries on a single line.

It is the tool of choice for teams that want their SQL to match a strict internal style guide — for example, uppercase keywords, snake_case columns and function names in lowercase. Consistency makes code review faster and lints trivial to write.

Like every ToolSink developer utility, the beautifier runs in the browser. Nothing is uploaded.

How to use the SQL Query Beautifier

  1. 1Paste the query you want to beautify.
  2. 2Pick a dialect from the dropdown.
  3. 3Choose keyword casing (UPPER, lower or leave as-is).
  4. 4Set indentation and comma placement (leading or trailing).
  5. 5Click "Beautify" and copy the polished query.

Key features

  • Configurable keyword, function and identifier casing
  • Leading or trailing comma style
  • Dialect-aware formatting
  • Optional single-line output for short queries
  • Preserves comments and hints
  • Runs offline

Examples

Enforce a house style

Convert a mixed-case query into UPPERCASE keywords + lowercase identifiers to match your team’s SQL style guide.

Leading-comma style

Beautify a SELECT list so each column starts with `, columnName` — a common style for auditors.

Why use this tool

  • Enforces a single house style automatically
  • Reduces bikeshedding in code review
  • Faster to scan than raw SQL
  • Supports many dialects and edge cases
  • Zero data leaks — runs in-browser

Common use cases

  • Enforcing a company-wide SQL style guide
  • Preparing queries for internal documentation
  • Standardising SQL in shared notebooks
  • Refactoring inherited legacy queries
  • Formatting queries auto-generated by ORMs

Frequently asked questions

How is this different from the SQL Formatter?

Beautifier exposes more style toggles (casing, comma style). Formatter is the fast default for casual use.

Can I save my style preferences?

Yes — preferences persist in your browser via localStorage.

Does it validate the query syntax?

It flags obvious parse errors but is not a full linter.

Which dialects are supported?

The same set as the SQL Formatter: MySQL, PostgreSQL, SQL Server, SQLite, BigQuery, Oracle and MariaDB.

Is my data uploaded?

No. All processing is client-side.