Free SQL Formatter
SQL Formatter formats or minifies SQL queries in 20 dialects, including PostgreSQL, MySQL, SQL Server, Oracle PL/SQL, BigQuery, Snowflake and SQLite. You choose keyword case, indentation and line breaks, and parse errors show the line and column where formatting stopped. Formatting changes only whitespace and, if you ask, letter case.
- Dialects:
- 20, from PostgreSQL to T-SQL
- Modes:
- Format or minify
- Engine:
- sql-formatter v15
- Price:
- Free
- Runs:
- Locally, in your browser
- Uploads:
- None: files never leave your device
- Account:
- Not needed
Quick answers
Does formatting change what my query does?
No. Only whitespace and, if you ask for it, the letter case of keywords, types, functions or identifiers change.
Processed on your device: your files are never uploaded. How it works
Network activity in this tab
What this page has requested since you opened the site in this tab. An upload is any request that sends data: POST, PUT, PATCH or a request with a body.
No uploads: nothing has been sent from this page.
No network requests yet.
To see every request, open your browser's developer tools (Network tab).
How to use the SQL Formatter
- Paste your SQL, open a .sql file or load the sample.
- Choose the dialect and the style: keyword case, indentation, line breaks and more.
- Copy or download the formatted query, or switch to Minify for a compact single line.
Credits & open source
Our own code plus open-source libraries. Thank you to the people who make these projects.
- SQL FormatterSQL pretty-printer for many dialects. © ZeroTurnaround LLC, George Leslie-Waksman and contributors · MIT
- CodeMirror 6Code editor with syntax highlighting. © Marijn Haverbeke and others · MIT
- @uiw/react-codemirrorReact wrapper for CodeMirror 6. © Kenny Wong (uiwjs) · MIT
Web platform APIs used: File API, Clipboard API.
Full license texts: third-party notices · all credits
Frequently asked questions
Why do I get a parse error?
Each database has its own syntax. Choosing the exact dialect (PostgreSQL, MySQL, SQL Server…) fixes most errors; the message shows the line and column where formatting stopped.
Is my SQL sent to a server?
No. Formatting and minifying run entirely in your browser.