SQL Formatter & Beautifier Online

Turn long one-line SQL into readable queries with uppercase keywords and aligned clauses.

Input —
Drop file to load
0 lines · 0 chars
Output —
0 lines · 0 chars
Ready. Paste something and press Beautify.

About this SQL Formatter & Beautifier

This SQL formatter breaks a query into clauses: SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY. It indents subqueries and turns keywords into uppercase. It's ideal for reading queries copied from logs, ORMs or BI tools.

Works with standard SQL used by MySQL, PostgreSQL, SQL Server, Oracle, SQLite and BigQuery.

Features

How to use

  1. Paste your SQL query.
  2. Press Beautify.
  3. Press Minify to collapse it into one line.
  4. Copy the query.

Example

Before

select id,name from users where city='Kochi' order by name

After

SELECT
  id,
  name
FROM
  users
WHERE
  city = 'Kochi'
ORDER BY
  name

Frequently asked questions

How do I format a SQL query online?

Paste the SQL above and press Beautify. Each clause starts on a new line and the columns are indented.

Does it work for MySQL and PostgreSQL?

Yes. Standard SQL syntax used by MySQL, PostgreSQL, SQL Server, Oracle and SQLite is supported.

More free formatters