FOR WEB DEVELOPERS

SQL Formatter

Format SQL queries with clean indentation and consistent keyword case, for MySQL, PostgreSQL, SQL Server, SQLite, BigQuery and more.

Code stays on your device

1 Your SQL

Processed in your browser. Nothing is uploaded.
THREE SMALL STEPS

How to format a SQL query

  1. 01

    Paste the query

    Paste one or more SQL statements, separated by semicolons.

  2. 02

    Pick the dialect

    Choose your database so its keywords, quotes and operators are recognized, then set keyword case and indentation.

  3. 03

    Copy the formatted SQL

    Select “Format SQL” and copy the readable query into your editor, a code review or documentation.

BEFORE YOU START

Good to know

Formatting is not validation

The formatter changes layout only. It does not check table names or run the query, so test it against your database.

Queries stay private

Queries often contain table names and customer values. Formatting happens in your browser, and nothing is sent to a server.

Placeholders are kept

Parameters such as ? in MySQL or $1 in PostgreSQL stay as they are when the matching dialect is selected.

QUESTIONS

Frequently asked questions

Can I format SQL without connecting to a database?

Yes. Paste the query, select its dialect and format it locally in your browser. The query is not executed and no database connection is opened. Formatting does not verify table names, permissions or query performance.

Why do I get an error for a valid query?

The selected dialect may not know a keyword or quote style your database uses. Choose the matching dialect, or Standard SQL for simple queries.

Can I format several queries at once?

Yes. Separate the statements with semicolons, and the formatter puts a blank line between them.

Does formatting change what my query does?

No. Only whitespace and, if you choose, the case of keywords change. Table names, column names, strings and values keep their spelling.