Skip to content
TConverter

SQL Formatter

In browser

Make your SQL readable or compress it to one line. 9 dialects, 5 styles, keyword case, indentation and more. Runs entirely in your browser.

Style

About the SQL Formatter

The TConverter SQL Formatter turns cramped, single-line or inconsistently written SQL into a clean, readable layout, and it can also do the opposite: compress a long, multi-line query into a single line. Queries copied from application logs, ORM output, stored procedures or a colleague's message become easy to read, review and share, and formatted queries are ready to paste back into your editor or into code.

Nine dialects are available: T-SQL (SQL Server), MySQL, PostgreSQL, MariaDB, SQLite, Oracle PL/SQL, Google BigQuery, Snowflake and Standard SQL. Choosing the right one matters, because each database has its own syntax. Square-bracket identifiers in T-SQL, the :: type cast and the ->> JSON operator in PostgreSQL, or backslash-escaped quotes in MySQL are only understood correctly when the matching dialect is selected.

Five styles change the overall layout. Standard puts every clause such as SELECT, FROM and WHERE on its own line with indented items. Aligned left and Aligned right place the keywords in a fixed-width column so that the expressions line up, a layout many teams use in code reviews. Compact keeps each clause on a single line, which is short yet still scannable. Single line minifies the whole query, which is handy for embedding SQL in application code, configuration files or log messages. Line comments are turned into block comments in this mode so they do not swallow the rest of the query, and text inside quotes is never changed.

You can fine-tune the result further. Keywords can be written in UPPER case, lower case or kept as typed, and the same case can optionally be applied to function names and data types such as COUNT and VARCHAR. Indentation can be 2 or 4 spaces or a tab, AND and OR can start or end a line, spaces around operators can be removed, and the semicolon can go on its own line. Your choices are remembered in your browser for the next visit.

The formatter is not a database and does not run your query or check it against a schema. It parses the text to understand its structure, so if the statement cannot be parsed you get an error message with the line and column of the problem. Formatting happens entirely in your browser: your queries, which may reveal table structures, business logic or data values, are never sent to a server. The result can be copied with one click or downloaded as query.sql.

Frequently asked questions

Which SQL dialects are supported?

T-SQL (SQL Server), MySQL, PostgreSQL, MariaDB, SQLite, Oracle PL/SQL, Google BigQuery, Snowflake and Standard SQL. Choose the dialect of your database so that its special syntax is parsed correctly.

Can I compress SQL into a single line?

Yes. Choose the Single line style and click “Minify”. Extra whitespace is removed, line comments become block comments and text inside quotes stays exactly as it was.

What is the difference between the aligned styles?

Both put keywords in a fixed-width column. Aligned left starts the keywords at the left edge, while Aligned right pushes them to the right so that the expressions start in the same column, sometimes called river style.

Are my queries sent to a server?

No. Formatting runs entirely in your browser, so your queries never leave your device. Only your style settings are remembered locally in your browser.

Does the formatter execute or validate my query?

No. It only changes the layout. It does not connect to a database or check table and column names; it reports an error only when the text cannot be parsed in the selected dialect.

Is the SQL formatter free?

Yes, it is completely free and does not require registration.