Skip to content
OnlineToolStudio

SQL Formatter

runs in your browserno sign-upfree

Format SQL queries for MySQL, PostgreSQL, SQL Server, SQLite and more, with keyword case options.

Formatting…

SQL317 chars
Formatted SQL

About this tool

This SQL formatter turns long one-line queries into clean, readable SQL: each clause (SELECT, FROM, JOIN, WHERE, GROUP BY…) on its own line, columns and conditions indented, and keywords in the case you choose. It understands the syntax of MySQL, MariaDB, PostgreSQL, SQL Server, SQLite, Oracle PL/SQL and BigQuery.

How to use

  1. Paste one or more SQL queries into the SQL box. They are formatted as you type.
  2. Choose your database dialect, keyword case (UPPER, lower or as typed) and indent.
  3. Copy the formatted SQL or download it as a .sql file.

FAQ

Is my SQL sent to a server or database?

No. Formatting runs entirely in your browser and nothing is executed. Queries with real table names or data never leave your device.

Why choose a dialect?

Databases have their own syntax — backtick `names` in MySQL, $1 parameters and :: casts in PostgreSQL, [names] and TOP in SQL Server. Picking the right dialect makes sure these are understood and formatted correctly.

Does it check if my SQL is correct?

Only partly. It reports SQL it cannot read, such as an unclosed bracket or quote, with the line and column. It does not check table or column names, or run the query.

Can I format several queries at once?

Yes. Queries separated by semicolons are formatted one after another, with a blank line between them.

Related tools

All tools