> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqlbuild.com/llms.txt
> Use this file to discover all available pages before exploring further.

# format

> Apply canonical SQLBuild SQL formatting.

# sqb format

Formats SQL files using SQLBuild's canonical, dialect-aware representation.

```bash theme={null}
sqb format [flags]
```

| Flag             | Description                                             |
| ---------------- | ------------------------------------------------------- |
| `--check`        | Fail when formatting changes are needed without writing |
| `--diff`         | Print the proposed diff without writing                 |
| `--json`         | Print structured results                                |
| `--select`, `-s` | Format selected models                                  |
| `--select-file`  | Read selectors from a file                              |
| `--exclude`      | Exclude models from the selected scope                  |

```bash theme={null}
sqb format
sqb format --check
sqb format --diff --select tag:marts
```

Formatting owns presentation. Use [`sqb lint`](/cli/lint) for diagnostics and [`sqb fix`](/cli/fix)
for safe semantic cleanups.
