Transcode
Docs
InputSQL
OutputSQL

SQL Format

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

Input
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.active = true and u.name <> 'O''Brien' group by u.id, u.name order by orders desc limit 10;
Output
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.active = TRUE
    AND u.name <> 'O''Brien'
GROUP BY
    u.id,
    u.name
ORDER BY
    orders DESC
LIMIT
    10;

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.