SQL Formatter & Minifier
Beautify or minify SQL queries with configurable keyword casing, indentation, and dialect support for PostgreSQL, MySQL, and SQLite.
About This Tool
Tokenizes and pretty-prints complex SQL statements by placing top-level clauses (SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY, LIMIT) on dedicated lines and indenting projection columns and boolean conditions.
Preserves string literals, PostgreSQL dollar-quoted strings, type casts (::), and parameter placeholders ($1, :name, ?) untouched while normalizing SQL keyword casing or minifying queries to one line.
Key Features
- Keyword casing modes: Convert reserved SQL keywords to UPPERCASE, lowercase, or keep their original casing without altering string literals.
- Clause-aware indentation: Splits SELECT column lists, JOIN clauses, and AND/OR predicates using 2 spaces, 4 spaces, or tabs.
- Dialect-aware tokenizer: Handles PostgreSQL :: casts and $$ strings, MySQL `backticks`, and SQLite [bracket] identifiers.
- One-click SQL minifier: Strip comments (-- and /* */) and collapse whitespace into a single-line query.