How to use
- Enter your SQL query.
- Click "Format".
- You'll see the result line-broken by clause — SELECT, FROM, WHERE, etc.
🎯 Use Cases
- Turn a complex single-line query into a readable form
- Standardize query formatting before a code review
- Understand structure when analyzing query logs
Example
Input
select id, name from users where active=1 and age>20 order by id
Output
SELECT id, name FROM users WHERE active=1 AND age>20 ORDER BY id
A single-line SELECT query is broken onto separate lines by its main clauses — SELECT, FROM, WHERE, ORDER BY — with keywords normalized to uppercase. Column lists and AND conditions are indented so the structure is easy to scan.
SQL structure clause by clause
Splitting a query at SELECT, FROM, WHERE and other clauses makes even long queries readable at a glance.
| Clause | Role |
|---|---|
SELECT | Columns and expressions to return |
FROM / JOIN | Source tables and join conditions |
WHERE | Row filter conditions |
GROUP BY / HAVING | Aggregation keys and post-aggregation filters |
ORDER BY | Result ordering |
LIMIT / OFFSET | Row count and start position |
FAQ
- Does it support every SQL dialect?
- It formats based on standard SELECT/INSERT/UPDATE/DELETE clause keywords, and works reasonably well with most SQL dialects (MySQL, PostgreSQL, etc.).
- Are keywords automatically uppercased?
- Yes. Major clause keywords like SELECT, FROM, and WHERE are normalized to uppercase for readability.
- Is the query I enter sent to a server?
- No. It's processed entirely in your browser.
- Are subqueries formatted too?
- Yes — subqueries in parentheses are also split by clause for readability.
- Do MySQL/PostgreSQL dialects work?
- It formats around standard SELECT structure, so most dialects tidy up well.
🗃️ Learn more: How to Format Messy SQL Queries
Break a one-line SQL statement into readable clauses
More Coding Tools
📘
JSON Formatter
Prettify, validate & minify JSON
🗓️
Timestamp Converter
Convert Unix timestamp ↔ date
🧩
JSON String Encoder
Convert text ↔ JSON string literal
✨
JS/CSS Formatter
Indent & tidy JS/CSS code
✂️
JS/CSS Minifier
Strip comments & whitespace
🧽
HTML Formatter
Indent HTML by tag structure
🧹
XML Formatter
Indent XML by tag structure
🔣
HTML Entity Encoder
Convert special chars ↔ HTML entities
📊
Excel to HTML Table
Convert spreadsheet data to HTML TABLE
⛓️
Link Extractor
Extract href/src links from HTML
🎨
Color Picker
Get HEX, RGB & HSL color codes
🐘
PHP Syntax Checker
Check bracket/string pairing (practical checker)
🗄️
MySQL Syntax Checker
Check bracket/quote pairing (practical checker)
🔍
HTML5 Validator
Check tag pairing, duplicate id, missing alt
✍️
Online HTML Editor
Write & edit HTML visually