SQL Formatter & Minifier

Paste a query and get it back neatly indented and easy to read — or squeezed onto one line for embedding in code.

What this tool does

The formatter splits your SQL into tokens and lays it out with each clause (SELECT, FROM, WHERE, GROUP BY, ORDER BY…) on its own line, one item per line in lists, joins and AND/OR conditions indented, and subqueries and CASE expressions nested. Only whitespace and the case of keywords are changed — string values, quoted names, numbers and comments are left exactly as you wrote them. Minify removes comments and extra whitespace (optimizer hints such as /*+ … */ are kept). It is a general-purpose formatter that suits standard SQL (MySQL, PostgreSQL, SQL Server, SQLite, Oracle); very vendor-specific syntax is passed through unchanged but may not be laid out perfectly. Everything runs in your browser; your queries are not uploaded.

Running into a technical issue or something that doesn't work right on this page? Please let us know straight away via our Contact page — that's how we find out what's broken and get it fixed.