Skip to content
TinySolve

SQL Formatter

Turn a one-line query into something you can read — and review before running.

Runs in your browser — nothing you type is sent anywhere

Indentation

Dialect

Formatted

The result appears here as you type. Nothing is sent anywhere — the work happens in this page.

The dialect matters: each database has its own keywords and quoting rules, and formatting with the wrong one can misread a valid query. Your SQL is parsed in your browser and never sent anywhere — which matters, because a query often contains table names, column names and literal values from a real system.

About the SQL Formatter

A query built by an ORM, copied out of a log or written in a hurry arrives as one long line. Formatting it — clauses on their own lines, joins indented, keywords capitalised — is often the fastest way to find the bug, because the structure of a query is the thing you are actually reasoning about.

Eight dialects are supported: standard SQL, MySQL, PostgreSQL, SQLite, MariaDB, SQL Server, BigQuery and Snowflake. The dialect matters more than it looks. Each has its own keywords, its own quoting rules and its own functions, and formatting with the wrong one can misread a perfectly valid query.

Keywords can be capitalised or left as written. Capitalising is the older convention and still makes a long query easier to scan, since it separates the language from your table and column names at a glance.

The formatting is cosmetic. Nothing is reordered, no clause is rewritten and no query is optimised — the query that comes out runs exactly as the one that went in. That is the point: a formatter that changed your SQL would be unusable for the case people most need it, which is reviewing something before running it.

Your query is formatted in your browser and never sent anywhere. A real query usually names real tables and columns, and often contains literal values from a production system, so that is not a detail.

How to use the SQL Formatter

  1. Paste your query

    One statement or several. Formatting is cosmetic — nothing is rewritten or optimised.

  2. Pick your dialect

    Each database has its own keywords and quoting rules, and the wrong one can misread a valid query.

  3. Choose capitalisation and indentation

    Capitalised keywords separate the language from your table names at a glance.

  4. Copy or download

    Take it to the clipboard or save it as a .sql file.

Frequently asked questions

Does it change what my query does?
No. The formatting is purely cosmetic — nothing is reordered, rewritten or optimised. The query that comes out runs exactly as the one that went in, which is essential when you are reviewing something before running it.
Why does the dialect matter?
Because each database has its own keywords, quoting rules and functions. Backticks mean something in MySQL and nothing in PostgreSQL. Formatting with the wrong dialect can misread a valid query.
Should keywords be in capitals?
SQL does not care, but a reader does: capitalising SELECT, FROM and WHERE separates the language from your table and column names, which makes a long query far easier to scan. It is on by default and easy to turn off.
Can it format several statements at once?
Yes. A script with several statements separated by semicolons formats fine, each one on its own.
Is my query sent anywhere?
No. It is formatted in your browser. A real query names real tables and columns and often contains literal values from a production system — none of that leaves your device.