SQL Formatter
Pretty-print SQL queries locally with dialect-aware formatting. Queries never leave your browser.
SELECT u.id, u.name, count(o.id) AS order_count, sum(o.total) AS revenue FROM users u LEFT JOIN orders o ON o.user_id = u.id WHERE u.active = TRUE AND o.created_at >= '2026-01-01' GROUP BY u.id, u.name HAVING count(o.id) > 3 ORDER BY revenue DESC LIMIT 20;
How it works
Readable SQL reduces review time and prevents subtle mistakes in joins and filters. This formatter uses a client-side SQL formatting library to tokenize your statement and re-emit it with consistent indentation, keyword casing, and line breaks. Dialect selection adjusts reserved words and subtle syntax differences so PostgreSQL, MySQL, SQLite, and other common engines format cleanly. Because formatting is structural rather than executive, your query is never run against a database from this site. That separation keeps credentials and live data out of scope while still helping you tidy migration scripts, ORM output, and ad-hoc analytics queries. Large scripts are processed in-memory; extremely huge dumps may be slower on modest devices—format logical sections when needed. Always validate critical changes in your own SQL client after formatting, especially when mixing proprietary extensions.
Frequently asked questions
Will formatting change query semantics?
It aims to preserve meaning while adjusting whitespace and casing. Review critical queries after formatting.
Which SQL dialects are supported?
Common dialects such as PostgreSQL, MySQL, SQLite, MariaDB, and standard SQL are available in the selector.
Is my SQL sent to a server?
No. Formatting runs offline in the browser with no query execution or logging pipeline.
Can it format multiple statements?
Yes in most cases. Very large scripts may be easier to format in chunks on slower devices.
More private tools
- JSON to TypeScriptGenerate interfaces or types from any JSON sample.
- Cron Expression BuilderBuild, explain and preview cron schedules.
- JWT DecoderInspect token headers, claims and expiry.
- Regex TesterLive match highlighting, groups and replace.
- Format ConverterJSON, YAML, CSV, XML and TOML in any direction.