Free Online SQL Formatter

Format SQL with configurable dialects. Preserves string literals and comments correctly.

Input

Output

SELECT id, name, email FROM users WHERE active = 1 ORDER BY created_at DESC;

How to use

  1. Paste your SQL into the input editor.
  2. Choose a dialect from the dropdown.
  3. Click Format SQL to beautify it.
  4. Use Copy or Download to save.

Dialects

  • Standard SQL
  • PostgreSQL
  • MySQL
  • MariaDB
  • SQLite
  • TSQL (SQL Server)
  • PL/SQL (Oracle)

Example input

SELECT id, name, email FROM users WHERE active = 1 ORDER BY created_at DESC;

SQL Formatter FAQ

Which SQL dialects are supported?

The formatter supports standard SQL plus MySQL, PostgreSQL, SQLite, T-SQL and other dialects exposed by the sql-formatter library. Pick the closest dialect for the most accurate keyword handling.

Are string literals and comments preserved?

Yes. Quoted strings, identifiers and comments are tokenized rather than rewritten, so their contents are not reformatted or lost.

Does this tool execute my SQL?

No. It only reformats text in your browser. No database connection is made and no query is run or sent anywhere.