★

SQL Formatter

Beautify a SQL query: keywords in capitals and each main clause on its own line.

Updated · Free · No sign-up

Send on WhatsApp

How to use the SQL Formatter

Type or paste your text into the first box. The result appears immediately in the second box, ready to copy or download. Replace the sample text with your own.

Worked example

Input:

select o.id, c.name, sum(o.amount) as total from orders o inner join customers c on c.id = o.customer_id where o.status = 'paid' and o.amount > 1000 group by o.id, c.name order by total desc limit 10

Output:

SELECT
  o.id,
  c.name,
  SUM(o.amount) AS total
FROM orders o
INNER JOIN customers c ON c.id = o.customer_id
WHERE o.status = 'paid'
  AND o.amount > 1000
GROUP BY o.id,
  c.name
ORDER BY total DESC
LIMIT 10

Frequently asked questions

What does the SQL Formatter do?

Beautify a SQL query: keywords in capitals and each main clause on its own line.

Is the SQL Formatter free to use?

Yes. It is free, needs no sign-up and works on phones, tablets and computers. Everything is calculated in your browser, so what you enter is not sent to or stored on a server.

Related online tools