SQL Formatter

Prettify and normalize SQL across dialects with configurable keyword case and indentation.

Example input3 lines, 151 B
12 lines, 167 B

Related tools

What it does

Formats and normalizes SQL for nine dialects, including Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server, BigQuery, Snowflake, MariaDB, and Oracle PL/SQL. Reindents clauses, breaks long statements onto readable lines, and lets you set keyword case, indent width, and line width. A minify mode does the reverse: it strips comments and collapses a query onto one line without touching anything inside quotes. Handles multiple semicolon-separated statements in one paste.

How to use it

Paste a query or a batch of statements into the left pane, or drop a .sql file on it, and the result appears live on the right. Pick the dialect that matches your database, then adjust keyword case, indent width, line width, or spacing between queries in the toolbar. Switch Mode to Minify for a one-line version. If the query does not parse, the offending line is marked and Go to line selects it. Copy or download the result, and the URL updates so you can share exactly what you see.

Why this one

Most online SQL formatters cap how much you can paste, run ads next to the output, or push a signup wall after a few uses, and all of them send your query to a server first. This one runs the formatter locally in your browser: your files and inputs never leave your device, there is no length cap, and no ads.

FAQ
Which SQL dialects are supported?
Standard SQL, PostgreSQL, MySQL, SQLite, SQL Server (T-SQL), BigQuery, Snowflake, MariaDB, and Oracle PL/SQL. Pick the one that matches your database for dialect-specific syntax like PostgreSQL casts or T-SQL square-bracket identifiers.
Does it validate or run my SQL?
No. It only reformats whitespace and casing, it does not check the query against a schema or execute it, so a formatted query can still fail at the database if the SQL itself is wrong. Minify mode does not parse the query at all: it removes comments and extra whitespace and leaves string literals and quoted identifiers exactly as written.
Is my query uploaded anywhere?
No, your files and inputs never leave your device. Formatting happens entirely in your browser.

Keyboard shortcuts: press ? anywhere on this page to see them.