SQL Tools
Format, beautify and minify SQL for 11 dialects — or switch to Compare to diff two queries.
Formatting Options
Input
Output
Formatted SQL appears here
Examples
Format a joined aggregate query
select u.id,u.name,count(o.id) as orders from users u left join orders o on o.user_id=u.id where u.active=true group by u.id,u.name order by orders desc;SELECT
u.id,
u.name,
COUNT(o.id) AS orders
FROM
users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE
u.active = TRUE
GROUP BY
u.id,
u.name
ORDER BY
orders DESC;With the default Standard SQL configuration, keywords and functions are uppercased and clauses are wrapped with two-space indentation.
Minify SQL and strip comments
SELECT id, name -- visible columns
FROM users /* active accounts */
WHERE active = true;SELECT id, name FROM users WHERE active = true;The minifier removes line and block comments and collapses whitespace without running the dialect formatter.
Use cases
Normalizing SQL in code review
Format a query with the team's dialect and casing rules so reviewers can focus on logic rather than layout.
Cleaning generated SQL
Turn compressed ORM or log output into a readable statement for debugging and query-plan analysis.
Preparing an embeddable statement
Minify a reviewed query when a single-line form is more convenient for fixtures, scripts or configuration.
Standardizing migration files
Apply consistent indentation, clause wrapping and keyword casing before committing database changes.
Common mistakes
Mistake:Formatting with the wrong SQL dialect.
Fix:Select the target database first so dialect-specific syntax and quoting are parsed correctly.
Mistake:Treating successful formatting as proof that a query is safe or correct.
Fix:Run the statement against the intended database, inspect parameters and permissions, and review its execution plan separately.
Mistake:Using Minify on SQL whose comments carry required hints or operational context.
Fix:Review comments before minifying; the minifier deliberately removes both line and block comments.
Mistake:Expecting the minifier to be a complete dialect-aware lexer.
Fix:Use it for ordinary quoted SQL; verify statements that rely on dialect-specific quoting, dollar strings or unusual comment syntax.
Frequently asked questions
Which SQL dialects does the formatter support?
Eleven, powered by the sql-formatter engine: Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle (PL/SQL), BigQuery, Redshift, Spark SQL and Snowflake. Pick the dialect that matches your database so keywords, functions and quoting are handled correctly.
Can I control keyword and identifier casing?
Yes. There are independent controls for keywords, data types, functions and identifiers — each can be forced to UPPERCASE, lowercase or preserved as written. You can also set the indent width (or use tabs), choose standard vs tabular indentation, put logical operators (AND/OR) at the start or end of lines, and set the expression width for wrapping.
What does the Minify button do?
Minify collapses your SQL onto a single line: it strips comments and reduces runs of whitespace while preserving the exact contents of quoted strings and identifiers. It's the inverse of formatting — handy for embedding a query in code or a config value.
Is my SQL sent to a server?
No. Formatting, minifying and comparing all run entirely in your browser. Your queries never leave your device, so it's safe to paste production SQL.
Related guides
How to Format Stored Procedures: T-SQL, PL/SQL, and PL/pgSQL
Beautify SQL Server, Oracle, and PostgreSQL stored procedures online. Dialect-aware indentation, keyword casing, and privacy-first browser formatting.
How to Generate Database Migration Scripts from DDL Diffs
Compare old and new CREATE TABLE schemas and generate PostgreSQL, MySQL, or SQLite ALTER and DROP migration SQL online — with destructive change warnings.
From Spreadsheet Rows to SQL INSERT Statements
How to turn a CSV export into typed, quoted, and safe SQL INSERT statements — and why the naive string-concatenation approach breaks on quotes, NULLs, and dates.
Build SELECT Queries Without Syntax Errors
The canonical clause order — SELECT, FROM, WHERE, GROUP BY, ORDER BY, LIMIT — and the most common mistakes when typing SQL by hand, from unescaped quotes to forgotten GROUP BY columns.
References & standards
Related tools
Base32 Encoder / Decoder
Encode and decode Base32 (RFC 4648) with hex input mode and Crockford variant. Handles TOTP secrets. Runs in-browser.
Base58 Encoder / Decoder
Convert hex or text to Base58 and back, with Base58Check validation (version byte + checksum). IPFS CIDs too. In-browser.
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
BibTeX to JSON Converter
Parse .bib bibliographies into structured JSON with authors, months, macros and LaTeX cleanup, all in-browser.
C# to VB.NET Converter
Convert a subset of C# — classes, methods, variables, loops — into VB.NET
CSV Data Viewer
Paste CSV and inspect it as a sortable, searchable table with delimiter detection and inline export.