SQL formatter

Paste a SQL query to format it with clean line breaks and indents, for MySQL, PostgreSQL, SQL Server, Oracle, SQLite and more.

Your files stay on your device. Nothing is uploaded.

SQL formatter

Updates as you type

Step 1: Paste SQL

Step 2: Choose the style

Keywords
Indent

Step 3: Copy the formatted SQL

How to format SQL

  1. Paste SQL

    Paste one query or several, separated by semicolons.

  2. Choose the database and style

    Pick your database so its own keywords are understood, and choose keyword case and indent.

  3. Copy the result

    Copy the formatted SQL or download a .sql file.

About this tool

Easier to read and review

Each clause (SELECT, FROM, JOIN, WHERE, GROUP BY) starts on its own line and columns are listed one per line, so long queries are easy to read and changes are easy to compare.

Dialects

Each database has its own syntax, such as backtick names in MySQL, :: casts in PostgreSQL or square brackets in SQL Server. Choosing the database makes these format correctly.

Your query stays private

Queries often include table names and data. Formatting happens in your browser; the query is not sent anywhere.

Privacy

This tool runs in your browser, on your own device. Your files and text are not uploaded to our server and we cannot see them. When you close or reload this tab, they are cleared, along with the results.

Frequently asked questions

Does formatting change what the query does?

No. Only spaces, line breaks and, if you choose, keyword case change.

Why does it say the SQL could not be read?

The query has a syntax the formatter does not understand, often an unclosed quote or bracket, or a dialect feature. Try choosing the right database.

Is my SQL uploaded?

No. It runs in your browser, so nothing you type or choose is sent anywhere.

Does it check my SQL is correct?

No. It formats the text; it does not run the query or check table names.