What the formatter changes and what it leaves alone
The query is first split into pieces: keywords, names, numbers, operators, strings and comments. Only the spaces and line breaks between those pieces change, plus the letter case of SQL keywords. Text in quotes is never touched, so 'Sign in' stays 'Sign in', a column written as "order" or `select` keeps its name, and comments stay word for word.
Function names such as COUNT, YEAR or DATE change case only when they are called with brackets. A column that happens to be called date or year keeps the spelling you gave it.
The layout it produces
SELECT
c.name,
COUNT(o.id) AS orders
FROM
customers c
LEFT JOIN orders o ON o.customer_id = c.id
AND o.status = 'paid'
WHERE
c.country = 'BD'
AND c.created_at >= '2026-01-01'
GROUP BY
c.name
ORDER BY
orders DESC
LIMIT 20;
- Each main clause starts a line, with its content indented below it.
- Columns, tables, GROUP BY and ORDER BY items, SET assignments and inserted rows get one line each.
- AND and OR start new lines in WHERE, HAVING and join conditions, except the AND inside BETWEEN.
- A subquery in brackets is indented one level further and its closing bracket lines up with the line that opened it.
- Several statements separated by semicolons are split with a blank line between them.
Pick uppercase, lowercase or the case you typed for keywords, and two spaces, four spaces or tabs for the indent, to match your team’s style.
Database dialects it understands
- MySQL and MariaDB: `backtick` names, # comments and backslash escapes inside strings.
- PostgreSQL: ::type casts, $1 placeholders, $$ dollar-quoted function bodies and the ->, ->>, #> and #>> JSON operators.
- SQL Server: [square bracket] names.
- SQLite and standard SQL: "double-quoted" names and '' to escape a quote inside a string.
CASE expressions, window functions such as ROW_NUMBER() OVER (…), and CREATE TABLE column lists stay on one line. The formatter does not run or check the query, so an unclosed quote shifts the layout of everything after it, which is a quick way to spot one.
Minify, comments and code reviews
Minify puts the query on a single line, handy for a log message, a config value or a string in code. It removes comments as it goes, because a -- comment would otherwise swallow the rest of the query once the line breaks are gone.
Formatting every query the same way before it goes into version control keeps code reviews about logic rather than spacing: a changed condition shows up as one changed line in the diff instead of a rewrapped paragraph. The formatter runs entirely in your browser, so production queries and table names are not sent anywhere.