SQL Formatter is a free online tool that formats and minifies SQL queries instantly in your browser. Supports MySQL, PostgreSQL, SQL Server, Oracle, SQLite, BigQuery, Snowflake and 18 dialects. No data is sent to any server.
What is SQL Formatting?
SQL (Structured Query Language) is the standard language for interacting with relational databases. Whether you write queries for MySQL, PostgreSQL, SQL Server, Oracle, or cloud platforms like BigQuery and Snowflake, well-formatted SQL is dramatically easier to read, review, and debug. Pair it with the [DB Viewer](/dbviewer) to run formatted queries against SQLite databases.
Formatting (pretty-printing) takes dense, hard-to-scan SQL and adds consistent indentation, line breaks, and keyword casing — so you can spot JOIN conditions, WHERE clauses, and subqueries at a glance. Compression (minification) does the reverse: it strips comments and collapses whitespace for the smallest possible SQL string.
This tool runs entirely in your browser. No data is ever sent to any server.
How to Format SQL
- 1
Paste your SQL
Paste or type SQL into the input editor. Select the correct dialect (MySQL, PostgreSQL, etc.) for syntax-aware formatting.
- 2
Configure options
Choose indent size, keyword casing (UPPER, lower, preserve), function casing, tabs vs spaces, and the number of blank lines between statements.
- 3
Format or compress
Click Format to beautify the SQL, or Compress to minify it. Copy the result with one click.