SQL formatter
Paste a query and get a readable version: SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY and the other clauses each start a line, selected columns are listed one per line, AND and OR conditions line up under their clause, and subqueries are indented. Keywords can be uppercased or lowercased. Strings, quoted identifiers and comments are never changed, so the query does exactly what it did before. It works with the SQL of PostgreSQL, MySQL, SQLite, SQL Server and Oracle.
Mode
Indent
Strings, quoted names and comments are never changed.
How to use the SQL Formatter
- 1
Paste your SQL
One query or several separated by semicolons.
- 2
Choose the style
Indentation and keyword case.
- 3
Copy the result
Or switch to Minify for a single line.
When to use it
- Read a long query generated by an ORM or copied from a log.
- Tidy SQL before a code review.
- Turn a formatted query into one line for a config file.
Limits
- The formatter does not check whether the SQL is valid.
- Procedural code such as PL/pgSQL or T-SQL blocks is formatted as plain statements.
Privacy
Queries are formatted in your browser. Nothing you paste is sent anywhere.
Frequently asked questions
Does formatting change what the query does?
No. Only whitespace and the case of keywords change; strings, identifiers and comments stay exactly as written.
Which databases does it support?
Standard SQL as used by PostgreSQL, MySQL, MariaDB, SQLite, SQL Server and Oracle, including quoted identifiers with double quotes, backticks and brackets.
Why are keywords uppercased?
It is a common convention that makes keywords stand out from table and column names. You can turn it off.
Can it format several statements?
Yes. Separate them with semicolons and each is formatted with a blank line between.
Is my SQL uploaded?
No. It is formatted in your browser.
Related tools
People also use
- JWT Generator & SignerCreate and sign JSON Web Tokens with HMAC, RSA or ECDSA keys, entirely in your browser.
- Base64 Encoder & DecoderEncode and decode Base64 and Base64url, text or files.
- URL Encoder & DecoderPercent-encode or decode URLs and see their query parameters.
- CSV to JSON ConverterConvert CSV ⇄ JSON with correct quoting, types and nested data.
Last updated November 22, 2026 · How we build and test our tools