SQL Formatter & Beautifier

Paste a messy one-line query and get a clean, indented, readable SQL statement.

SQL Formatter

🔒 Nothing you enter is sent anywhere or stored. All processing happens in your browser.

How it works

SQL that arrives as one long line — from a log, an ORM, or a colleague — is painful to read and review. Formatting it onto multiple lines with the major clauses aligned makes the query's structure obvious: what's being selected, from where, with which filters and ordering.

This formatter normalises whitespace, then puts each major clause (SELECT, FROM, WHERE, JOINs, GROUP BY, ORDER BY, and more) on its own line, indents AND/OR conditions and comma-separated columns, and can uppercase keywords in the conventional style. The result is a tidy, reviewable statement.

It's a lightweight beautifier that works well for typical SELECT/INSERT/UPDATE/DELETE statements and runs entirely in your browser — your queries, which may reference private schema, are never uploaded. Very complex nested queries may need a little manual polish.

Examples

One-line SELECT → SELECT / FROM / WHERE / ORDER BY each on its own line.
Column list → each column indented on a new line for easy diffing.
Untick "uppercase" to keep your keywords lowercase.

Frequently asked questions

Does it validate my SQL?
No — it formats for readability but doesn't check that the query is valid or safe to run.
Which statements does it handle?
Common SELECT, INSERT, UPDATE, DELETE and DDL statements. Deeply nested subqueries may need minor manual tidying.
Can it keep keywords lowercase?
Yes — untick 'Uppercase keywords' and it will lowercase them instead.
Is my query sent anywhere?
No. Formatting happens entirely in your browser.