How to use
- Paste your query, or click Load sample.
- Choose the SQL dialect, indentation and keyword case.
- Click Format, or press Ctrl+Enter (⌘+Enter on Mac).
- Copy the formatted query.
Options explained
- SQL dialect
- Handles dialect-specific syntax such as backtick identifiers in MySQL, :: casts and $1 parameters in PostgreSQL, square brackets in SQL Server and QUALIFY in Snowflake and BigQuery.
- Keywords
- UPPER writes SELECT, FROM, WHERE in capitals; lower writes them in lower case; Keep leaves them as typed. Table and column names are never changed.
Examples
Before
select id,name from users where status='active' order by name
After
SELECT
id,
name
FROM
users
WHERE
status = 'active'
ORDER BY
name
Frequently asked questions
Does it check that my query is valid?
No. It formats the query's structure but does not check table names, column names or whether your database would accept it.
Can I format several statements at once?
Yes. Statements separated by semicolons are formatted one after another.
Is my query uploaded?
No. Formatting runs in your browser, so queries with real table names or data stay private.
Privacy
This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.