SQL Formatter
Beautify SQL queries with dialect-aware indentation. Supports PostgreSQL, MySQL, SQLite, MS SQL and more.
Formatted SQL appears here
What is a SQL Formatter?
A SQL formatter takes minified or poorly indented SQL and adds consistent capitalisation, indentation, and line breaks so the query is easy to read, review, and debug. Most database consoles and ORM query logs output SQL on a single line — a formatter makes complex queries with multiple JOINs, CTEs, or subqueries readable instantly.
This tool formats SQL for MySQL, PostgreSQL, SQLite, and SQL Server dialects — all in your browser.
How to format SQL online
- Paste your raw or minified SQL query into the Input box.
- The formatted SQL appears instantly in the Output panel.
- Click Copy to paste it into your database client or editor.
Frequently Asked Questions
Does the formatter support all SQL dialects?
The formatter handles standard SQL syntax and works well with MySQL, PostgreSQL, SQLite, and SQL Server queries. Highly vendor-specific syntax may not always format perfectly.
Does formatting SQL change how it runs?
No. Formatting only adds whitespace and normalises keyword capitalisation. The query executes identically to the original.
What is the benefit of uppercasing SQL keywords?
Uppercasing keywords (SELECT, FROM, WHERE) is a widely adopted convention that makes it visually easy to distinguish keywords from table names and column names, especially in complex queries.
Can I format stored procedures and multi-statement SQL?
Yes. The tool handles multi-statement SQL including stored procedures, triggers, and DDL statements such as CREATE TABLE and ALTER TABLE.