Developer Tools
SQL Formatter and Beautifier
Beautify and minify SQL for ten dialects.
- No external services
- Built by Derar Sattouf
SQL Formatter
Input
Output
Loading…
Guide
What is the SQL Formatter?
The SQL Formatter beautifies SQL queries in your browser: one clause per line, consistent indentation and the keyword case you choose. Pick the dialect that matches your database, from PostgreSQL and MySQL to SQL Server, Oracle, BigQuery and Snowflake, or minify a query to a single line with comments removed.
Last updated: November 2026 · Built by Derar Sattouf
How to use it
- 01Paste your SQL into the input panel.
- 02Pick the dialect, keyword case and indent width.
- 03Read the formatted query, or switch to minify for a one-line version.
- 04Copy the result.
Features
- Ten dialects: standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle PL/SQL, BigQuery, Snowflake and Redshift
- Keywords in upper case, lower case or as written
- Two or four spaces of indentation
- Minify removes comments and extra whitespace, leaving quoted strings untouched
- Formats as you type
- Runs locally: no upload, no sign-up
Frequently asked questions
Is my SQL sent to a server?
No. The tool runs entirely in your browser with JavaScript, so your SQL is never sent to my server.
Does formatting change what my query does?
No. Formatting changes only whitespace, line breaks and, if you ask for it, the case of keywords. Minify also removes comments. Table names, column names, values and quoted strings stay exactly as you wrote them.
Which SQL dialects can it format?
Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle PL/SQL, BigQuery, Snowflake and Redshift. Choosing the right dialect matters for syntax that differs between databases, such as backtick identifiers in MySQL or dollar-quoted strings in PostgreSQL.
Does it check that my SQL is valid?
No. It is a formatter, not a database: it does not connect to anything or run the query. It reports an error only when it cannot read the text at all, for example with an unclosed parenthesis or a syntax the selected dialect does not have.
Can I format several statements at once?
Yes. Separate the statements with semicolons and each one is formatted in turn, with a blank line between them.
Related developer tools
- JSON FormatterFormat, validate and minify JSON online, explore it in a tree view and convert it to CSV, XML or YAML. Free, private and runs in your browser. Paste and go.
- CSS FormatterBeautify messy or minified CSS with Prettier, or minify it for production. Paste your stylesheet and get clean, consistent code instantly. Free and private.
- HTML FormatterBeautify messy HTML with Prettier or minify it for production. Clean up templates, emails and copied markup in seconds. Free online HTML formatter, private.