SQL Formatter & Pretty Print

Format and pretty print SQL queries online. Supports Standard SQL, MySQL, PostgreSQL, Oracle, and SQL Server dialects.

Instantly format complex SQL queries into a clean, readable layout. Select your specific SQL dialect (such as PostgreSQL or T-SQL) for perfectly adapted syntax rules.

How to Use Pretty Print

  1. Paste your raw or messy SQL query into the input editor.
  2. Select the specific SQL dialect if necessary, and choose your indentation preference.
  3. Click "Format".
  4. Copy the cleanly formatted SQL query.

What Is Pretty Print?

SQL Formatting reorganizes messy database queries by capitalizing keywords, aligning clauses (like SELECT, FROM, WHERE), and adding proper indentation. This makes large, complex queries significantly easier to read, review, and debug.

Pretty Print Example

Input
select id, name from users where active=1
Output
SELECT
  id,
  name
FROM
  users
WHERE
  active = 1

Frequently Asked Questions

Which SQL dialects are supported?

This formatter supports standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, and SQL Server formatting rules.

Does formatting execute the query?

No. This tool only parses the text of the query and rewrites the syntax locally. It does not connect to a database or execute any code.

Related SQL Tools