SQL Formatter
This SQL formatter reformats queries with consistent indentation and keyword casing for seven dialects, or minifies them onto one line.
About this tool
This SQL formatter reformats queries with consistent indentation and keyword casing for seven dialects, or minifies them onto one line.
How to use it
- Paste your SQL query.
- Choose the dialect, indentation (2 spaces, 4 spaces or tab) and keyword case.
- Click Format SQL, or Minify for a single line.
- Copy the output.
Good to know
- Supported dialects: Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL (SQL Server), PL/SQL (Oracle) and MariaDB.
- Keyword case can be UPPERCASE, lowercase or preserved as written.
- Formatting uses the open-source sql-formatter library and only changes whitespace and keyword case, not query logic.
- Minify collapses all whitespace into single spaces.
Runs entirely in your browser — nothing you enter is uploaded or stored.
Frequently asked questions
Does formatting change how my query runs?
No. Only whitespace and keyword casing change; the query's meaning stays the same.
Why choose a dialect?
Dialects have different syntax, such as backtick identifiers in MySQL or square brackets in T-SQL. Picking the right one helps the formatter parse your query correctly.
Does the tool validate my SQL?
It is a formatter, not a validator. Syntax it cannot parse shows an error, but a query that formats cleanly may still fail against your database.
Is my query sent to a server?
No. Formatting runs in your browser.