SQL formatter
Format messy SQL into clean, readable queries with each clause on its own line, columns and conditions indented and keywords in capitals. Or minify a query to one line. Works with MySQL, PostgreSQL, SQL Server, SQLite and BigQuery; runs in your browser.
Runs in your browser. Nothing is uploaded.What the formatter does
- Starts each clause (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY…) on a new line.
- Puts each selected column and each AND / OR condition on its own indented line.
- Indents subqueries and leaves strings, quoted names and comments exactly as they were.
The formatter only changes spacing and keyword case, so your query does exactly the same thing. It doesn't check that the SQL is valid; run it in your database to find errors.
Questions
Is my SQL sent to a server?
No. Formatting happens in your browser, so it's safe for queries that mention internal tables.
Does it change my data or table names?
No. Only SQL keywords change case; names, strings and numbers are left alone.
More free tools
Meta description generator
Write meta descriptions and preview your Google listing.
Website screenshot
Capture any website on desktop, tablet or mobile.
JSON formatter
Format, validate and minify JSON.
Website speed test
Core Web Vitals and Google PageSpeed scores for any page.
DNS propagation checker
See what 8 public DNS providers return for your domain.
Invoice generator
Make a professional invoice with VAT and save it as a PDF.
Merge PDF
Combine several PDFs into one file, in any order.
Compress PDF
Make PDFs smaller for email and uploads.