SQLFormatter
FormatterConvertPricingDocsGet Pro
Formatter & beautifier · BigQuery

Format & beautify BigQuery SQL online

Format and beautify BigQuery SQL: consistent indentation, aligned clauses, uppercase keywords — and minified one-liners expanded back into readable code.

1Paste your BigQuery query into the editor.
2Press Format — or ⌘↵.
3Copy clean, highlighted SQL.
Open formatter
before
select user_id,array_agg(event order by ts) as events from `proj.analytics.events` where date(ts)=current_date() group by user_id limit 1000;
BigQuery
SELECT
  user_id,
  array_agg(
    event
    ORDER BY
      ts
  ) AS events
FROM
  `proj.analytics.events`
WHERE
  date(ts) = current_date()
GROUP BY
  user_id
LIMIT
  1000;

Why format BigQuery?

BigQuery's Standard SQL adds STRUCT and ARRAY types, ARRAY_AGG, backtick-quoted `project.dataset.table` references and date functions like CURRENT_DATE(). The formatter parses BigQuery grammar so fully-qualified table names and array constructs survive formatting.

Ideal for the long analytical queries that come out of the BigQuery console or dbt models.

Beautify minified BigQuery SQL

BigQuery analytics queries get long — nested STRUCTs, ARRAY_AGG, window functions — and dbt or the console often emit them minified. Beautifying spreads the STRUCT fields and clauses across indented lines so the aggregation is legible.

For queries you'll commit into a dbt model, that clean layout matters twice over: it's what your team reviews in the diff and maintains later.

minified
SELECT s.user_id,STRUCT(count(*)AS n,sum(s.value)AS total)AS agg FROM `proj.analytics.sessions` s WHERE DATE(s.ts)BETWEEN '2026-01-01' AND '2026-06-30' GROUP BY s.user_id HAVING sum(s.value)>0 ORDER BY agg.total DESC;
BigQuery · beautified
SELECT
  s.user_id,
  STRUCT(count(*) AS n, sum(s.value) AS total) AS agg
FROM
  `proj.analytics.sessions` s
WHERE
  DATE(s.ts) BETWEEN '2026-01-01' AND '2026-06-30'
GROUP BY
  s.user_id
HAVING
  sum(s.value) > 0
ORDER BY
  agg.total DESC;

Frequently asked questions

Does the formatter understand BigQuery-specific syntax?

Yes. The query is parsed against BigQuery grammar rather than generic SQL, so BigQuery-only constructs survive formatting: STRUCT/ARRAY, backtick project.dataset.table.

What is the difference between formatting and beautifying BigQuery SQL?

Nothing — they are two names for the same operation. "Format" usually describes tidying SQL you wrote yourself; "beautify" usually describes expanding a minified or ORM-generated one-liner into readable lines. This page does both, with a worked example of each above.

Is my SQL uploaded anywhere?

No. Formatting runs entirely in your browser — the query never leaves your machine and nothing is stored on a server.

Is the BigQuery formatter free?

Yes: free, no account, no usage limit. Only the optional AI features — explain, optimize and dialect conversion — require signing in.

All SQL formatters & beautifiers

Format PostgreSQLFormat MySQLFormat T-SQLFormat SQLiteFormat BigQueryFormat OracleFormat SnowflakeFormat Redshift