# Read any SQL query neatly laid out, without changing the file

> Preview .sql files with the keywords right-aligned in one column, so joins, conditions and subqueries read at a glance. The file is never modified.

A query written on three long lines is hard to read. Press Space on a `.sql` file and Gander lays it out with the keywords right-aligned in one column, so every clause, join and condition lines up. The file itself never changes: **Raw** shows it as written.

![weekly_report.sql on the Raw tab in Dark Mode: the query as written, in lowercase, run together on a few long lines.](https://ganderfinder.com/img/features/sql-raw-2x.webp)
![weekly_report.sql on the Formatted tab in Dark Mode: SELECT, FROM, JOIN, WHERE, GROUP BY and ORDER BY right-aligned in one column.](https://ganderfinder.com/img/features/sql-formatted-2x.webp)

## How to do it

1. Install Gander from the Mac App Store and open it once.
2. Select a `.sql` file in Finder and press Space.
3. Read the **Formatted** tab, or switch to **Raw** for the file as written. Turn on line numbers when you need them.

## The river layout

Gander uses the classic “river” style: clause keywords such as SELECT, FROM, JOIN, WHERE and GROUP BY are right-aligned, so everything after them starts on one column.

- One selected column per line, with the aliases lined up
- Joins with their ON conditions, and one condition per line with AND and OR in the river
- CTEs, subqueries, CASE expressions and window functions laid out to match
- Keywords in capitals, while names, quoted names and strings keep their case

## Safe by design

Only spacing and keyword case change. Each statement is checked word by word against the original and kept as written if anything would differ. Code Gander can’t lay out safely, such as procedures, dbt `{% %}` blocks and psql scripts, is shown as written.

## Coloured, and in thumbnails too

Both views are syntax-coloured, and Finder thumbnails show the formatted query, so you can tell your queries apart at a glance.

## Questions

### Does Gander rewrite my .sql file?

No. The layout is only on screen. Gander never writes to the file, and Raw shows it exactly as written.

### Which SQL does it lay out?

The layout follows the shape of the query rather than one dialect: SELECT, INSERT, UPDATE, DELETE and WITH statements, along with words such as QUALIFY and SQL Server’s GO batches. Anything it can’t lay out safely stays as written.

### Can I copy the formatted query?

Yes. The copy button copies the view on screen: the laid-out query on Formatted, the original on Raw.

## More guides

- [Preview Markdown in Finder, rendered the way GitHub shows it](https://ganderfinder.com/markdown-quick-look)
- [View Mermaid diagrams on your Mac without a browser](https://ganderfinder.com/mermaid-viewer)
- [Turn Markdown into a PDF or a Word document, right from Finder](https://ganderfinder.com/markdown-to-pdf-word)
- [Convert CSV to Excel on your Mac, straight from Finder](https://ganderfinder.com/csv-to-excel)
- [Read Jupyter notebooks on your Mac without starting Jupyter](https://ganderfinder.com/jupyter-notebook-viewer)
- [A fast JSON viewer in Finder, for JSONC and JSON Lines too](https://ganderfinder.com/json-viewer)
- [Look inside an SQLite database from Finder](https://ganderfinder.com/sqlite-viewer)
- [Open log files at the newest line, with errors in red](https://ganderfinder.com/log-viewer)
- [Check a .env file without putting secrets on screen](https://ganderfinder.com/env-file-viewer)

Gander is free on the Mac App Store, with no in-app purchases, no subscription and no account, and nothing you preview leaves your Mac. https://apps.apple.com/app/id6817038818

---

- HTML version: https://ganderfinder.com/sql-formatter
- Español: https://ganderfinder.com/es/sql-formatter.md
- Deutsch: https://ganderfinder.com/de/sql-formatter.md
- Français: https://ganderfinder.com/fr/sql-formatter.md
- 日本語: https://ganderfinder.com/ja/sql-formatter.md
- 简体中文: https://ganderfinder.com/zh/sql-formatter.md
- Português (Brasil): https://ganderfinder.com/pt/sql-formatter.md
- Support: https://ganderfinder.com/support
- Privacy policy: https://ganderfinder.com/privacy
- llms.txt: https://ganderfinder.com/llms.txt
- © 2026 65FN LLC
