Back to Tools

SQL Formatter

My tools
No tools yet

Loading...

Format and beautify SQL online (multi-dialect, with minify)

  1. 1

    Paste your SQL

    Drop in a query, DDL, or a one-liner copied from logs — or click the example button to see it in action.

  2. 2

    Pick dialect and options

    Choose the dialect for your database and set keyword case and indent width to match your team's style; results render in real time.

  3. 3

    Copy or minify

    Copy the formatted output into your client or code; click minify first when you need a single line.

Features Overview

Format SQL online: paste a query for instant beautified output across 20 dialects (standard SQL, MySQL, PostgreSQL, SQLite, ClickHouse, Snowflake, and more), with keyword case, indent width, and blank-line controls plus one-click minify — all in your browser.

Tool Description

Free online SQL formatter and beautifier with minify. 20 SQL dialects, three keyword-case modes, indent width and blank-line controls; line comments convert to block comments when minifying so nothing gets swallowed. All local.

Last updated

Capabilities Checklist

  • 20 SQL dialects: standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, ClickHouse, DuckDB, Snowflake, TiDB, BigQuery, Oracle PL/SQL, Transact-SQL and more — pick the one matching your database.
  • Format and minify both ways: beautified output makes JOINs and subqueries readable; minify folds the statement into one line for logs and dynamic assembly.
  • Fine-grained options: keyword case (preserve/upper/lower), indent width (2/4/8 spaces), and a blank-line toggle between statements.
  • Minify-safe comments: line comments are converted to block comments before folding, so nothing after a comment gets swallowed.
  • Nothing leaves your browser: parsing and formatting run locally, with no length limit.

User feedback

Your feedback will be reviewed (and redacted if needed) before it appears publicly. Please do not include emails, passwords, or other personal information.

Your feedback helps us do better ❤️

Related Tools

Related Guides

Frequently Asked Questions

Which databases does this tool support?
20 dialects: standard SQL (sql), MySQL, PostgreSQL, SQLite, MariaDB, ClickHouse, DuckDB, Snowflake, TiDB, BigQuery, DB2, DB2 for i, Hive, N1QL, Oracle PL/SQL, Redshift, SingleStore, Spark SQL, Trino, and Transact-SQL. The dialect affects keyword recognition and formatting rules; use standard SQL when unsure.
Does formatting change what the SQL does?
No. Formatting only adjusts whitespace, line breaks, and keyword case — never logic; string contents stay untouched (the case option applies to SQL keywords, not your data). Minify is the same: it folds whitespace, converting line comments to equivalent block comments so semantics are preserved.
Can this tool check SQL for syntax errors?
No — it's a formatter, not a validator. Structural token errors (like an extra parenthesis) throw with a position hint, but most syntax errors pass through leniently (a missing table name may still format fine). To verify correctness, run EXPLAIN in your database or use your client's validation.
Where do comments go after minifying?
For single-line safety, line comments (-- and MySQL's #) are converted to block comments (/* ... */) and kept; delete them first if you don't want them. Spaces inside string literals collapse to a single space during minify — use format, not minify, when exact spacing matters.
Is my SQL uploaded anywhere?
No. Formatting runs entirely in your browser; statements never leave your device and it works offline.