SQL Formatter
Paste a long one-line query and get readable, consistently indented SQL — with your choice of dialect, keyword case and indentation. Minify it again for embedding in code.
How to use the SQL Formatter
- Paste your SQL query or script.
- Choose the dialect, keyword case and indent size.
- Press Format SQL (or Minify) and copy the result.
About the SQL Formatter
Queries copied from logs, ORMs and query builders usually arrive on a single line, which makes joins and conditions hard to review. Formatting puts each clause on its own line, indents subqueries and lines up column lists, so mistakes such as a missing join condition stand out. This tool uses the open-source sql-formatter library, which understands the syntax differences between dialects — backtick quoting in MySQL, square brackets in SQL Server, dollar-quoted strings in PostgreSQL. Your SQL never leaves the browser, so it is safe for queries that contain table names or data you would rather keep private.
Frequently asked questions
Does formatting change what my query does?
No. Only whitespace and, if you choose, keyword case change. The query logic and string values are untouched.
Which SQL dialects are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), SQLite, Oracle PL/SQL, BigQuery, Snowflake and Redshift.
What if my SQL has a syntax error?
The formatter reports where it got stuck. Choose the correct dialect first — many “errors” are dialect-specific syntax.
Is my SQL sent to a server?
No. Formatting runs in your browser.
Related free tools
- XML Formatter — Pretty-print, validate and minify XML — sitemaps, feeds, SOAP and config files.
- YAML to JSON Converter — Convert YAML to JSON and JSON to YAML, with clear error messages.
- Cron Expression Generator — Build and explain cron schedules in plain English, with the next run times.
- Color Contrast Checker — Check text and background colours against WCAG AA and AAA — with a fix suggestion.
- Meta Tag Generator — SEO title, description, Open Graph & Twitter tags — copy-ready.
- What Is My IP — Your public IP address, browser & device details.
Runs in your browser — what you enter stays on your device. Published .