SQL Formatter
Tidy common SQL statements.
How to use SQL Formatter
Format common SELECT, INSERT, UPDATE, and DELETE statements into readable clauses. Quoted strings, identifiers, and comments are preserved.
Good to know
This is a basic, dialect-neutral formatter, not a SQL parser or validator. Review complex procedural SQL before use. No query is executed.
Separate the main clauses of a query
Choose Format to try this example.
Input
select id, name from users where active = true order by name;
Expected result
SELECT id, name FROM users WHERE active = true ORDER BY name;
Common questions and mistakes
Does formatting check whether the query is correct?
No. This tool changes layout around common SQL keywords, but it does not parse a database schema, validate syntax, or run the query. Test the query in your database’s normal development environment.
When should I use a database-specific formatter?
Use one for procedural SQL, vendor-specific quoting, dollar-quoted strings, or complex nested queries. This basic formatter preserves standard quoted strings, identifiers, and comments, but does not cover every dialect. Keep your original query and review changes.
Related tools
- JSON Formatter — Format, validate, and minify JSON.
- UUID Generator — Generate random version 4 identifiers.