SQL Formatter & Minifier
Format SQL for PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, BigQuery and Snowflake, or minify it to one line. Comments, strings and placeholders stay.
Mode
At a glance
- Processing
- Locally in your browser, also offline once the page has been opened. Input never leaves your device.
- Dialects
- Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, BigQuery, Snowflake
- Kept as written
- Comments, strings, dollar quoting, placeholders (?, $1, :name, @name) and MySQL DELIMITER blocks
- For agents
-
WebMCP:
sql_format· Module:/core/sql-formatter.js· Markdown · llms-full.txt
How to Use
- 01 Paste your SQL Paste one or more statements, up to 2 MB. Choose the dialect your database speaks.
- 02 Choose the style Pick upper, lower or unchanged keywords and the indent width, or switch to minify for a single line.
- 03 Copy the result The result updates as you type. If the formatter cannot read something, it shows the line and column.
About this tool
Formatted SQL is easier to review: one clause per line, column lists indented, keywords in one case. The layout comes from the open-source library sql-formatter.
Large files are formatted in a background thread, so the page stays responsive.
Frequently Asked Questions
Only the syntax it needs to lay the code out. It does not run the query and does not know your tables, so a wrong column name is not reported.
The one of your database. It decides which quotes, comments and placeholders are understood, for example backticks in MySQL, [brackets] in SQL Server or $1 and $$ strings in PostgreSQL. Standard SQL works for simple queries.
The DELIMITER lines are kept. Each statement under a custom delimiter, such as a stored procedure ending in //, is formatted on its own and keeps its delimiter.
Comments and extra whitespace. Optimizer hints in /*! ... */ and /*+ ... */ stay, and nothing inside strings or quoted names changes.