SQL Formatter & Minifier
Paste a SQL query to lay it out with clean indentation and one clause per line, or minify it to a single compact line. Choose your database dialect, indentation and keyword case. Everything runs in your browser, so your queries are never uploaded.
0 bytes
How to use it
- Choose Format to make the query readable, or Minify to compact it.
- Paste your SQL into the input box, or press “Load sample”.
- For Format, pick your database (dialect), the indentation and whether keywords should be upper or lower case.
- Press the button, then copy the result or download it as a .sql file.
Frequently asked questions
Which databases are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake and Amazon Redshift. Choosing the right dialect matters for things like quoting rules, JSON operators and procedural code.
Does formatting change what my query does?
No. Only whitespace and, if you choose, the case of keywords change. Table names, column names and text inside quotes are never altered.
What does the minifier remove?
Comments and extra spaces and line breaks. Text inside quotes, quoted names and dollar-quoted blocks is kept exactly as written, and optimiser hints and MySQL version comments (written /*+ … */ and /*! … */) are kept because the database reads them.
Why do I get a parse error?
The formatter reads your SQL before laying it out. An unclosed quote or a character the chosen dialect does not allow stops it, and the message shows the line and column. Check that the right dialect is selected.
Is my SQL uploaded anywhere?
No. Everything runs in your browser. Even so, avoid pasting real passwords or personal data into any online tool.
Related tools
These tools run entirely in your browser and are provided free, without warranty. Check important results before using them in production.