OpenToolbox

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.

Loading tool…

Processed on your device: your files are never uploaded. How it works

How to use the SQL Formatter

  1. Paste your SQL, open a .sql file or load the sample.
  2. Choose the dialect and the style: keyword case, indentation, line breaks and more.
  3. 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.

Recommended

Sponsored · we may earn a commission · details

More developer tools tools