Skip to content

SQL formatter

Runs only in your browser. Your data is not sent to our servers.

Paste SQL to make it readable, or compress it to one line. Choose the dialect your database uses.

Result

About this tool

The formatter puts each clause on its own line and indents joins, conditions and subqueries. Comments are kept. The dialect matters for things like TOP and [names] in SQL Server, :: casts and $1 parameters in PostgreSQL, and back-quoted names in MySQL.

Each database writes query parameters its own way: @from_date in SQL Server, $1 in PostgreSQL, :from_date in Oracle and ? in MySQL and Snowflake. Standard SQL accepts all of them. The example follows the dialect you choose.

Compress puts the query on one line, for example for a connector setting or a JSON string. Text in quotes is not changed, and -- comments become /* */ comments so they do not swallow the rest of the line.

The formatter is not a full syntax check. It reports errors it meets, such as a quote or parenthesis that is not closed, but it does not know your tables or columns.

Shortcut: Ctrl + Enter formats the input.

Found a problem?

Tell us what went wrong. You decide whether your own work is included.

Licences

This tool is built with these third-party libraries:

Report a problem

Show exactly what will be sent

The report goes to the ipaashub team and is stored with Cloudflare in Western Europe, and included work in the EU. Included work is deleted when the problem is fixed, and at the latest after 90 days. See Privacy.