Back to SQL Formatter
SQL Formatter Guide

Format SQL in the BigQuery Console

Clean up GoogleSQL copied from the BigQuery Console before sharing it, committing it, or turning it into a scheduled query. This workflow keeps BigQuery-specific paths, STRUCT values, ARRAY expressions, and pipe stages recognizable.

Copy, format, and compare GoogleSQL

Paste the query from the BigQuery Console into the formatter, choose BigQuery, and press Format. The native GoogleSQL parser validates the syntax before producing output, while the Git-style diff makes whitespace and line-break changes easy to inspect.

The formatter is useful when a console query grows beyond a quick experiment. Partition filters, nested fields, UNNEST sources, and procedural statements remain visible instead of being compressed into a single generated line.

  • Keep backtick-qualified project, dataset, and table names intact.
  • Use the pipe-aware formatter for |> WHERE, |> EXTEND, and |> AGGREGATE stages.
  • Review the diff before copying SQL into a scheduled query or repository.
GoogleSQL example
FROM `my-project.analytics.events`
|> WHERE event_date >= DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY)
|> AGGREGATE COUNT(*) AS event_count
|> ORDER BY event_count DESC;

When to use a dedicated BigQuery formatter

Generic SQL beautifiers often understand SELECT and JOIN but not GoogleSQL relation pipelines or nested data. Use the dedicated BigQuery page when the query relies on STRUCT, ARRAY, UNNEST, partition decorators, or scripting syntax.

Continue with the formatter

Ready to format your SQL?

Choose a dialect, format a query, and review the result with a Git-style diff.

Open SQL Formatter