UnQTools
Developer Runs in your browser

SQL Formatter / Beautifier

Format and beautify SQL queries with dialect awareness (MySQL, PostgreSQL, SQLite, SQL Server, ANSI), keyword casing, indentation, comma style, and SELECT-column alignment. Pure in-browser; no network. 100% client-side.

100% Private Works Offline Instant

About SQL Formatter / Beautifier

Format and beautify SQL queries with dialect awareness (MySQL, PostgreSQL, SQLite, SQL Server, ANSI), keyword casing, indentation, comma style, and SELECT-column alignment. Pure in-browser; no network. 100% client-side. Everything runs locally in your browser — your data never leaves your device.

How to use

  1. Enter your input in the tool above.
  2. Adjust any options to your preference.
  3. Use the Copy or Download buttons to save the result.
  4. Everything happens locally — your data never leaves your browser.

FAQ

Which SQL dialects does this formatter support?

ANSI SQL (the standard baseline), MySQL/MariaDB, PostgreSQL, SQLite, and SQL Server (T-SQL). Dialect selection mainly controls how quoted identifiers (backticks, double-quotes, [brackets]) and vendor comments (--, #, /* */) are tokenized so the formatter never corrupts your code.

What style options can I control?

Keyword case (UPPER / lower / preserve), identifier case (preserve / upper / lower), indent style (spaces or tabs) and width, comma placement (trailing or leading), newline before major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, etc.), and SELECT-column alignment. Presets ship for popular styles (dbt, Poor-Man's-TSQL, pgcrypto-friendly).

Does the formatter change the meaning of my SQL?

No. We never reorder, add, or remove tokens. String literals ('…', "…", `…`, […]) and comments (-- line, # MySQL, /* block */) are preserved verbatim. Only whitespace, newlines, indentation, and keyword casing change. Run it through the in-tool diff to verify before/after are semantically identical.

Are my queries uploaded to a server?

Never. This is a 100% client-side formatter — your SQL never leaves the browser. History (last 20 operations) is stored in localStorage on this device only, and a shareable URL encodes your options in the fragment (after #), which browsers never send to servers.

What extra features does this tool have versus others?

(1) Five dialect presets. (2) Keyword + identifier case control. (3) Spaces or tabs indent with custom width. (4) Leading or trailing comma style. (5) SELECT-column alignment. (6) Comment preservation (-- # /* */). (7) String-literal safety (single, double, backtick, bracket). (8) Live before/after stats (chars, lines, tokens). (9) Saveable named presets + shareable-URL config. (10) localStorage history (max 20). (11) Copy / download .sql. (12) One-click sample SQL.

Search tools and actions

Search across all 616 tools, categories, and quick actions.