๐Ÿ—ƒ๏ธ SQL Statement Formatter

Line-breaks a SQL query by clause โ€” SELECT, FROM, WHERE, etc. โ€” for readability.

How to use

  1. Enter your SQL query.
  2. Click "Format".
  3. You'll see the result line-broken by clause โ€” SELECT, FROM, WHERE, etc.

๐ŸŽฏ Use Cases

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.

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.

๐Ÿ—ƒ๏ธ 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