Format, beautify, and indent your SQL queries online. Supports Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL, and Oracle with customizable keyword case and indentation.
Paste raw SQL code into the editor, drag and drop a .sql file, or click Upload to load queries from your local device.
Choose your database dialect (Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL, or Oracle) and customize keyword casing and indentation rules.
Click Format SQL to immediately beautify the query. Use Copy to send to your clipboard or Download as a .sql file.
See how single-line, unformatted production queries are restructured into clean, readable code blocks with proper clause hierarchy and indentation.
SELECT u.id,u.username,o.order_total,o.created_at FROM users u INNER JOIN orders o ON u.id=o.user_id WHERE u.status='active' AND o.order_total>100 GROUP BY u.id,u.username,o.order_total,o.created_at HAVING count(o.id)>2 ORDER BY o.order_total DESC LIMIT 20;
SELECT u.id, u.username, o.order_total, o.created_at FROM users u INNER JOIN orders o ON u.id = o.user_id WHERE u.status = 'active' AND o.order_total > 100 GROUP BY u.id, u.username, o.order_total, o.created_at HAVING count(o.id) > 2 ORDER BY o.order_total DESC LIMIT 20;
| Dialect | Identifier Quoting | Comments Supported | Special Syntax Features |
|---|---|---|---|
| Standard SQL (ANSI) | "identifier" |
-- line, /* block */ |
ANSI SELECT, INSERT, UPDATE, DELETE, WITH CTE, UNION |
| MySQL / MariaDB | `identifier` |
# comment, -- line, /* block */ |
LIMIT/OFFSET, ON DUPLICATE KEY UPDATE, Optimizer Hints |
| PostgreSQL | "identifier" |
-- line, /* block */ |
Dollar-quoting $$str$$, ON CONFLICT DO UPDATE, ILIKE |
| SQLite | "identifier", [id], `id` |
-- line, /* block */ |
PRAGMA, UPSERT, Window Functions, Lightweight syntax |
| Microsoft SQL Server (T-SQL) | [identifier] |
-- line, /* block */ |
CROSS APPLY, OUTER APPLY, TOP (N), @IDENTITY, Schema prefixes |
| Oracle SQL (PL/SQL) | "identifier" |
-- line, /* block */ |
CONNECT BY, ROWNUM, FETCH FIRST, DUAL table, Triggers |
.sql or .txt file from your computer using the Upload button or drag-and-drop. After formatting, click Download to save the result as a clean .sql file.