SQL Minify
Format SQL queries with consistent indentation, or minify them.
Paste your input on the left and press Translate (or Ctrl/Cmd + Enter) to get the result on the right. Free, no sign-up.
Example
-- Active users with order counts
SELECT
u.id,
u.name,
COUNT(o.id) AS orders
FROM
users u
LEFT JOIN orders o ON o.user_id = u.id /* join on owner */
WHERE
u.note = 'keep these spaces'
GROUP BY
u.id,
u.name;SELECT u.id,u.name,COUNT(o.id)AS orders FROM users u LEFT JOIN orders o ON o.user_id=u.id WHERE u.note='keep these spaces' GROUP BY u.id,u.name;
Frequently asked questions
- Which SQL dialects work?
- Standard SQL formatting works for most queries. Dialect-specific syntax may be laid out less precisely.
- Does it change what the query does?
- No. Formatting only changes whitespace and upper-cases keywords. Minify strips comments and extra whitespace.