Instantly beautify, indent, and format SQL queries in your browser. Free, fast, no signup required.
Paste your raw or minified SQL into the input field and click Format / Beautify. The tool adds proper line breaks before each major clause (SELECT, FROM, WHERE, JOIN, etc.) and indents sub-clauses for readability. Use Minify to compress it back to a single line.
SELECT, FROM, WHERE, JOIN (LEFT, RIGHT, INNER, FULL), ON, GROUP BY, ORDER BY, HAVING, LIMIT, OFFSET, UNION, INSERT INTO, VALUES, UPDATE, SET, DELETE FROM, CREATE TABLE, ALTER TABLE.
• Readability — format auto-generated or minified queries before reviewing them.
• Code review — share well-formatted SQL in PRs and documentation.
• Debugging — indent complex nested queries to spot logic errors.
Format SQL programmatically with the REST API (requires API key, $5/mo):
## curl
curl -X POST https://apitoolkit.pro/api/v1/sql-formatter \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"input":"SELECT id,name FROM users WHERE active=1","action":"format"}'
## Response
{ "result": "SELECT id, name\n FROM users\n WHERE active=1" }