SQL Formatter
Make long SQL queries readable. Pick your database dialect, keyword case and indentation, or collapse a query onto one line. Formatting is powered by the open-source sql-formatter library and runs on your device.
Formatted SQL
How to format SQL
- Paste one or more SQL statements into the input.
- Select the SQL dialect that matches your database.
- Choose keyword case (UPPER, lower or preserve) and indentation.
- Copy the formatted query, or switch to Minify for a single line.
Frequently asked questions
Which SQL dialects are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake, Redshift, Spark, DB2, Hive, Trino and more, as supported by sql-formatter.
Does it check whether my query is correct?
It only reports errors it hits while parsing for formatting. It does not run your query or check table and column names.
What does SQL minify do?
It removes comments and collapses whitespace outside string literals and quoted identifiers, producing a single-line query.
Related tools
- JSON FormatterPretty-print or minify JSON with clear error locations.
- CSS FormatterBeautify or minify CSS stylesheets.
- Case ConverterConvert to camelCase, snake_case, Title Case and more.
More in Code & Data.