SQL Formatter / Minifier
Paste a SQL query — get it neatly formatted with indentation and line breaks. Need it compact instead? Switch to minify. Pick the dialect of your database for correct keyword handling.
Why format SQL. A long single-line query is impossible to read and review. The formatter lays out keywords, indentation, and line breaks per the chosen dialect — the query becomes clear at a glance. Minification does the opposite: it strips extra spaces and newlines when you need to embed the query in a code string or pass it compactly. Everything runs in the browser; the query is never sent anywhere.
FAQ
Does the formatter change my query?
No. Only whitespace, line breaks, and keyword case change — the query logic stays the same. It is safe: the result executes exactly what the original did.
Why choose a dialect?
Different databases have their own keywords and syntax (e.g. LIMIT in MySQL vs TOP in SQL Server, PostgreSQL-specific functions). Choosing the dialect helps the formatter recognise constructs correctly and not break the layout.
Is my SQL sent to a server?
No, formatting runs in your browser in JavaScript. The query is never transmitted or stored — safe even for confidential queries.
Can I format several queries at once?
Yes, paste an entire script with multiple statements separated by semicolons — the formatter processes each and keeps the separators.
Free online SQL formatter and minifier. Paste a query and the tool pretty-prints it with indentation, line breaks, and consistent keyword case, or minifies it into one compact line. Supports MySQL, PostgreSQL, SQLite, MariaDB, SQL Server, and standard SQL dialects.
Formatting never changes the query logic — only the layout — so the result is fully equivalent to the original. Handy for code review, debugging complex JOINs and subqueries, maintaining migrations, and preparing queries for documentation. Minification helps when SQL must be embedded in a code string.
Everything runs in the browser: the query is not sent to a server and is not stored, so even confidential queries are safe to format. The tool is useful for developers, analysts, and database administrators — to tidy up any SQL quickly.