Skip to content
Changelog
new tooltext-data

SQL Formatter

v1.0

SQL Formatter makes a pasted query readable. Pick a dialect (standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server T-SQL, BigQuery, Snowflake, Redshift or Oracle PL/SQL), a keyword case (upper, lower or as typed), an indent width, and how many blank lines to leave between statements.

It tidies joins, CTEs, window functions and whole migration files, and leaves string literals, -- and /* */ comments, placeholders (?, $1, :name, @name) and dialect syntax like Postgres :: casts or MySQL backticks exactly as you wrote them. Pasting formats automatically. Minify does the reverse and collapses a query to one line, safely around quoted strings and comments.

You can drag a .sql file onto the drop area, click to upload, or load the sample. Checking runs as you type, and the status says "No syntax errors" rather than "Valid SQL" because the check is lenient: it catches unclosed strings, unbalanced brackets and misplaced tokens, but it isn't a full grammar check. Errors show a line and column, and you can click to jump to them. Changing the dialect re-checks right away.

Your dialect, case, indent and statement-gap choices are remembered on this device, and Share puts the query and options in a link.

All changes