SQL Formatter
Format, beautify, and minify SQL instantly. Handles SELECT, INSERT, UPDATE, DELETE, CREATE and more. Everything runs in your browser — nothing is sent to a server.
How to use
Paste your SQL query into the input area above. Click Format to pretty-print with keywords on new lines and proper indentation. Use Minify to collapse the query to a single line with normalized whitespace.
Options let you choose 2 or 4-space indentation and whether keywords like SELECT, FROM, and WHERE are uppercased automatically.
The formatter handles string literals (single and double quotes), single-line -- comments, multi-line /* */ comments, and nested subqueries with increased indentation. Your data never leaves your browser.
Supported statements: SELECT, INSERT INTO, UPDATE, DELETE FROM, CREATE TABLE, ALTER TABLE, DROP TABLE, WITH (CTEs), subqueries, JOINs, CASE expressions, UNION / UNION ALL, and more.