SQL Formatter & Minifier

Beautify or minify SQL queries with configurable keyword casing, indentation, and dialect support for PostgreSQL, MySQL, and SQLite.

Private by architecture: All processing is 100% client-side memory. Your data never leaves this browser tab.
SQL query input
0 lines · 0 charsSQL
Formatted SQL output
0 lines · 0 chars

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.

Frequently Asked Questions

Does changing Keyword Case modify text inside single-quoted strings?
No. The SQL tokenizer separates quoted string literals ('...'), double-quoted identifiers ("..."), and backtick identifiers (`...`) from SQL keywords before applying case rules.
What does Minify mode do to SQL comments?
Minify mode strips both single-line (-- and #) and block (/* ... */) comments so collapsing newlines cannot accidentally comment out the remainder of your query.
Are PostgreSQL :: type casts and $1 placeholders supported?
Yes. The tokenizer keeps :: attached to the expression without extra spaces and preserves positional ($1, ?) and named (:id, @id) bind parameters.
Are my SQL queries sent to a server?
No. Formatting and minification run locally in your browser.