SQL Formatter
Format and compact SQL queries in your browser with sql-formatter—pick a dialect, beautify readable SQL, or minify to a single line and copy.
Formatted SQL
Tips
Pick the right dialect
Keyword casing and line breaks differ between MySQL, PostgreSQL, T-SQL, and others—choose the closest match.
Compact vs format
Format adds indentation and line breaks. Compact collapses whitespace for logs or embedded queries.
Incomplete SQL
Fragments or dialect-specific syntax the library does not know may still format but with less accuracy.
Copy quickly
Use Copy after formatting to paste into your IDE or database client.
Dialect selection
Support for generic SQL, MySQL, PostgreSQL, SQLite, MariaDB, T-SQL, PL/SQL, and BigQuery.
Readable formatting
Indent joins, clauses, and subqueries for easier review.
Client-side only
sql-formatter from CDN runs in your browser; queries stay local.
What this tool does
SQL Formatter beautifies pasted queries for readability or compacts them for storage and logging.
It uses the open-source sql-formatter package with dialect-aware keyword handling—all in the browser.
How to use
Select dialect
Choose the SQL engine that best matches your query.
Paste SQL
Add one or more statements you want to format.
Format or compact
Run Format for readable output or Compact for a shorter line, then copy.
Processing and privacy
sql-formatter is loaded from CDN and executes locally.
Queries are not transmitted to Toolomix for formatting.
Limitations
Known limits
- Not a SQL validator or query planner
- Complex procedural SQL may format imperfectly
- Compact mode is whitespace reduction, not semantic minification
- Very long scripts may slow the browser
Frequently Asked Questions
Is my SQL sent to a server?
No. Formatting uses the sql-formatter library in your browser. Your query is not uploaded.
What is the difference between Format and Compact?
Format produces multi-line indented SQL. Compact reduces whitespace to a shorter single-line style suitable for logs.
Which dialect should I choose?
Pick the engine you target. Generic SQL works for simple ANSI-style statements; use MySQL or PostgreSQL for engine-specific syntax.
Does it validate SQL?
It formats text structurally but does not guarantee the query will execute on your database. Syntax errors may still appear.
Can it format stored procedures?
Multi-statement batches may format partially depending on dialect and complexity.
Why did formatting fail?
Highly unusual syntax or incomplete fragments can confuse the parser. Try generic SQL or simplify the snippet.
Try Other Free Tools
Try it now
Paste a query, pick a dialect, and format or compact locally.