๐Ÿ—„๏ธ SQL Formatter

Paste raw or messy SQL and get it back clean, indented and readable. Uppercase keywords, proper structure. Runs entirely in your browser.

Formatted SQL


    

What is a SQL formatter?

A SQL formatter takes raw or compressed SQL queries and transforms them into clean, readable code with consistent indentation and uppercase keywords. This makes queries easier to read, review, debug and share with teammates.

When should I format SQL?

Whenever you're reading queries from a log file, debugging a complex JOIN, reviewing someone else's code, or preparing SQL for documentation. Consistent formatting also helps with code reviews and version control diffs.

SQL formatting conventions

The standard convention is to write SQL keywords (SELECT, FROM, WHERE, JOIN, etc.) in uppercase and table/column names in lowercase. Each major clause starts on a new line with consistent indentation for nested conditions.

Does this support all SQL dialects?

This formatter handles standard SQL including MySQL, PostgreSQL, SQLite and SQL Server syntax. Dialect-specific functions and types are preserved as-is โ€” the formatter only restructures layout, it doesn't change semantics.

More tools from Useful Patch

๐Ÿ“‹
JSON Formatter & Validator
Format, validate and minify JSON instantly in your browser.
โ†’
๐Ÿงพ
Invoice & PO to CSV
Extract data from supplier PDFs into clean spreadsheet format. From ยฃ199.
โ†’