SQL Formatter & Minifier

About this tool

Format tidies up a SQL statement by uppercasing recognised keywords, placing each major clause — SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY and more — on its own line, indenting the selected columns and putting each comma-separated field on a new line. Minify collapses the whole query onto one compact line by removing redundant whitespace.

A small hand-written tokenizer scans the query character by character, keeping string literals and quoted identifiers intact so their contents are never altered. It is a lightweight pretty-printer, not a full SQL parser, so exotic dialect syntax may not be reflowed perfectly. Everything runs locally in your browser — your queries are never uploaded.

Related tools

JSON FormatterCSS FormatterJS Minifier