How it works
How to use the SQL Formatter
Paste SQL
One query or a whole script with multiple statements.
Pick your dialect
Dialect-specific syntax such as PostgreSQL casts or T-SQL brackets is handled correctly.
Choose a style
Keyword case, indentation and spacing between queries. Or switch to Minify for a compact one-liner.
Supported dialects
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark SQL, DuckDB, ClickHouse, Trino/Presto, DB2 and Hive. Formatting never changes the meaning of your query: string literals, quoted identifiers and comments are preserved exactly.
Built for developers
Why developers use it
Private by design
Runs 100% in your browser. Nothing you paste is uploaded, logged or stored on a server.
Instant results
Output updates as you type, with precise error locations when something is wrong.
Works offline
Once loaded, the tool keeps working without a connection. Install it as an app if you like.
Free, no sign-up
No accounts, no limits, no watermarks.
FAQ
Frequently asked questions
Why did formatting fail?
The formatter parses your SQL, so unbalanced parentheses or quotes cause an error with a line and column. Choosing the matching dialect also helps with vendor-specific syntax.
Does minifying remove comments?
Yes. Minify removes comments and collapses whitespace, but never touches the contents of strings or quoted identifiers.
Is my data uploaded anywhere?
No. This tool runs entirely in your browser. Your input never leaves your device, is not logged, and works offline once the page has loaded.
Keep going
Related tools
- SQL to JSON ConverterConvert SQL INSERT statements to JSON
- SQL to CSV ConverterConvert SQL INSERT statements to CSV
- JSON to SQL ConverterGenerate INSERT statements from JSON
- SQL MinifierCompress SQL onto a single line
- SQL to TSV ConverterConvert SQL INSERT statements to TSV
- SQL to XML ConverterConvert SQL INSERT statements to XML
- JSON FormatterFormat, validate and explore JSON
- HTML FormatterBeautify or minify HTML markup