SQL Formatter
Format and beautify SQL queries online. Add proper indentation, capitalize keywords, and make your SQL readable.
How to Use
- 1
Paste your SQL query
Enter a SQL query of any complexity — from simple SELECTs to multi-table JOINs with subqueries.
- 2
Click Transform
The formatter capitalizes keywords, adds line breaks at major clauses, and indents sub-clauses.
- 3
Copy or download
Copy the formatted SQL to your clipboard or download it as a .sql file.
What is SQL Formatter?
A SQL formatter takes a SQL query — often written on a single line or with inconsistent formatting — and restructures it with proper indentation, keyword capitalization, and line breaks to make it easy to read and understand.
Well-formatted SQL is essential for code reviews, debugging complex queries, documentation, and maintaining large SQL codebases. Most style guides recommend uppercase keywords (SELECT, FROM, WHERE), each major clause on its own line, and consistent indentation for sub-clauses.
This formatter handles SELECT queries, JOINs, WHERE clauses, GROUP BY, ORDER BY, subqueries, INSERT, UPDATE, DELETE statements, and common SQL keywords across all major databases (PostgreSQL, MySQL, SQL Server, SQLite, Oracle).
FAQ
Does this work with all SQL dialects?
Does it validate my SQL?
Will it change my query logic?
Related Articles
Related Tools
JSON Validator
Validate your JSON data instantly. Check for syntax errors, see detailed error messages, and get document statistics.
JSON Formatter & Beautifier
Format, beautify, and pretty-print JSON data online. Choose indentation style, copy or download the result. Free, fast, and private.
JSON Tree Viewer
Visualize JSON data as an interactive, collapsible tree. Explore nested objects and arrays with ease.