SQL Formatter
Formats SQL that is crammed onto one line into a clearly indented structure — very useful for reading slow-query logs.
Paste a messy SQL query and get it formatted — or minified to one line. Keywords upper-cased, clauses indented, one field per line. Supports PostgreSQL, MySQL, T-SQL, BigQuery and 8 more dialects, free in your browser.
Steps and notes
What is SQL Formatter — Format and Beautify SQL Online?
Paste a SQL query and get it formatted — keywords upper-cased, joins and clauses indented, one field per line — with dialect-aware parsing for PostgreSQL, MySQL, T-SQL, PL/SQL, SQLite, BigQuery, Redshift, Hive, Spark, MariaDB, DB2 and N1QL. A formatted query is the fastest way to review a 40-line join before running it.
- Paste the SQL
- Pick a dialect (optional)
- Copy the formatted result
Frequently asked questions
- Why should I pick the right dialect?
- Dialects differ in keywords, quoting and comment syntax. Formatting with the engine you actually run keeps identifiers like backtick-quoted names or @variables recognised and placed correctly.
- Does formatting change how my query executes?
- No — whitespace and case are irrelevant to the SQL engine. Formatting is purely for humans; the query plan stays identical.
- Can it minify SQL back to one line?
- Prettifying is the core job. For a compact form, most developers keep the formatted version as the source of truth and let their tools strip whitespace on deploy.
- How do I make a slow-query log readable?
- Paste the whole one-line statement and let the formatter expand it — the JOIN structure and WHERE conditions become visible at a glance, which is usually where the slow part hides.
Category: Development
XML tools workflow
XML Formatter — Beautify, Validate and Minify XML → SQL Formatter — Format and Beautify SQL Online → JSON to XML → XML to JSON