SQL Formatter & Minifier

Pretty-print SQL with your choice of keyword case and indentation, or compress it to one line.

Raw SQL Query
100% Client-Side
Processed Output
Original Size 0 bytes
Processed Size 0 bytes
Compression Ratio 0%
Syntax Linter Ready

Paste a SQL query and either format it into clean, indented, readable code or minify it down to a single line. It's built on a real SQL tokenizer rather than blunt find-and-replace, so it understands strings, comments and keywords and won't mangle the parts of your query that just happen to contain a keyword. It all runs in your browser.

Formatting options

You control how the formatted output looks. Keyword case can be forced to UPPERCASE, lowercase, or left as you wrote it — uppercasing keywords like SELECT, FROM and WHERE is a common convention that makes queries easier to scan. Identifier case is handled separately so your table and column names can stay untouched. And you can set the indent size so nested clauses line up the way your team prefers.

Minify, and what the tool does not do

Minifying strips comments and collapses the query to one line, which is handy for embedding SQL in code or a config value. The tool preserves the contents of string literals and comments while tokenising, so quoted text isn't accidentally reformatted. One important limit: it works at the syntax level and does not connect to a database — it won't tell you whether your query is correct, whether the tables exist, or how it will perform. It formats and compresses; it doesn't validate or execute.

Frequently Asked Questions

Does it check that my SQL is correct?

No. It formats or minifies the text using a tokenizer, but it does not connect to any database, so it cannot confirm that tables or columns exist or that the query runs. Test correctness in your database.

Will it change my table and column names?

Only if you ask it to. Keyword case and identifier case are separate settings — you can uppercase keywords while leaving identifiers (table and column names) exactly as written.

Does it handle SQL comments?

Yes. The tokenizer recognises both -- single-line and /* multi-line */ comments. Formatting preserves them, and minifying removes them along with extra whitespace.

Which SQL dialect does it support?

It formats generic SQL syntax, so it works across common dialects (MySQL, PostgreSQL, SQL Server and others). Because it does not execute anything, dialect-specific features are reformatted as text rather than validated.