All tools

SQL Formatter & Beautifier

Format and minify SQL queries in six SQL dialects, with syntax highlighting.

Browser onlyYour input is processed in this browser and is not sent to SpeedyTools servers.
Share:
Options
Yes
SQL Input
About the SQL formatter

SQL Formatter reformats SQL so each clause sits on its own line with consistent indentation. It works on anything from a single SELECT to multi-table JOINs with subqueries.

Consistent formatting makes queries easier to review and keeps diffs small when a team edits the same SQL. The tool uses the open-source sql-formatter library.

Features
Multiple SQL dialects (MySQL, PostgreSQL, SQLite, T-SQL, PL/SQL)
Configurable indentation (2 or 4 spaces)
Uppercase keywords
Minify SQL to a single line
Syntax highlighting with line numbers
Copy to clipboard
Common use cases

Code review

Format SQL before a review so diffs are easier to read

Documentation

Format SQL queries for technical documentation

Learning SQL

See the structure of a long query once it is indented

Query debugging

Find mistakes faster when each clause is on its own line

Frequently asked questions

What SQL dialects does the formatter support?

Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL (Microsoft SQL Server) and PL/SQL (Oracle). Each dialect setting accounts for differences such as quoting styles and dialect-specific keywords.

Does the SQL formatter handle complex queries?

Yes. It handles subqueries, CTEs (Common Table Expressions), JOINs, window functions and nested conditions, and indents each nested level.

What is SQL minification?

Minification removes comments and extra whitespace so the query fits on one line. Use it to embed SQL in a code string or to shrink an API payload.

Is my SQL data safe?

Yes. Formatting runs in your browser, and the tool does not send your queries to a server.

Can I use this for production SQL formatting?

Yes. The tool uses the open-source sql-formatter library. Formatting changes only whitespace and keyword case, so you can use the output in your codebase, documentation or database tools.

Private by default

The tool formats SQL in your browser and sends nothing to a server.