SQL Formatter & Minifier
Beautify or compact SQL queries across 10 dialects — instantly, privately, and fully in your browser.
SQL Formatter & Minifier reformats SQL queries for readability — indenting clauses, capitalizing keywords, and supporting 10 dialects including MySQL, PostgreSQL, SQL Server, and Oracle — or compacts a query by stripping comments and extra whitespace. Runs entirely in your browser using the open-source sql-formatter library, with no upload. Made by FreeToolHub.
SQL Input
Output
How it works
Paste a SQL query, pick a dialect out of ten (Standard SQL, MySQL, PostgreSQL, SQL Server, Oracle, SQLite, MariaDB, BigQuery, Snowflake, Redshift), and Format rewrites it with one clause per line, consistent indentation, and your choice of keyword casing — using the open-source sql-formatter library, the same engine used by many IDE SQL formatters. Switch to Minify to strip comments and collapse the query to the shortest valid single-line form, useful for embedding a query in application code. Neither mode ever touches table names, column names, values, or query logic — only whitespace and casing change.
Frequently Asked Questions
Is my SQL query uploaded anywhere?
No. Formatting and minifying both run locally in your browser using JavaScript. Your query, including any table names or values it contains, is never sent to a server.
Which SQL dialects are supported?
Ten dialects: Standard SQL, MySQL, PostgreSQL, SQL Server (Transact-SQL), Oracle (PL/SQL), SQLite, MariaDB, Google BigQuery, Snowflake, and Amazon Redshift. Each dialect understands its own syntax quirks, such as backtick-quoted identifiers in MySQL, TOP instead of LIMIT in SQL Server, and BigQuery's backtick table paths.
What does formatting actually do?
It rewrites whitespace and line breaks so each clause (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY) starts on its own line and nested subqueries are indented, and it can capitalize, lowercase, or preserve the case of SQL keywords. Table names, column names, string values, and query logic are never changed.
What does minifying do?
It collapses all whitespace to single spaces and removes comments, producing the shortest valid version of the same query. By default all comments are stripped; checking "Keep block comments" preserves /* ... */ comments such as Oracle optimizer hints, but -- line comments are always removed, since keeping one in a single-line query would silently comment out everything after it.
Will formatting or minifying change what my query does?
No. Both only change whitespace, line breaks, and keyword casing. Identifiers, string and numeric literals, operators, and clause order are always preserved exactly, so the query executes identically before and after.
Is there a query length limit?
There is no fixed limit. Since everything runs in your browser, performance depends on your device, but typical queries of several thousand lines format instantly.