SQL Prettify and Format
Reformat a SQL query onto multiple lines with uppercase keywords, making it easier to read and review.
This is a lightweight, pattern-based formatter for common SQL - it doesn't fully parse SQL syntax, so deeply nested subqueries or unusual dialects may not format perfectly.
Input SQL
Formatted SQL
Recommended Settings
Pro Tips
- •Major clauses (SELECT, FROM, WHERE, JOIN, ORDER BY, and similar) are each placed on their own line for easy scanning
- •All recognized SQL keywords are uppercased, following the common convention that distinguishes keywords from table and column names
- •Comma-separated columns in a SELECT list are placed on their own indented lines for long column lists
- •For complex queries with deeply nested subqueries or vendor-specific syntax, review the output carefully since this is a lightweight formatter, not a full SQL parser
Most Popular
Most developers use this to quickly clean up a query before pasting it into a pull request or documentation
When to Use This Tool
Clean up a query's formatting before including it in code review or documentation.
Break a dense, single-line query into a clearly structured, multi-line format.
Uppercase SQL keywords consistently across a codebase or document.
Reformat a query exported from a database tool into a more readable layout.
How It Works
Normalize whitespace and uppercase recognized SQL keywords
Insert a line break before each major clause (SELECT, FROM, WHERE, JOIN, ORDER BY, and similar)
Indent comma-separated items in lists, then clean up any resulting blank lines
100% Private
Files never leave your device. All processing happens locally in your browser.
Lightning Fast
Powered by Client-side pattern-based SQL formatting for optimal performance on modern browsers.
Open Source
Built with verified, open-source libraries. Fully transparent.
Frequently Asked Questions
Does this validate my SQL syntax?
No, this formats SQL text based on keyword patterns - it doesn't parse or validate query correctness, so invalid SQL may still 'format' without any warning.
Does this work with all SQL dialects?
It handles standard, widely used SQL keywords well, but vendor-specific syntax (like some Oracle, T-SQL, or PostgreSQL extensions) may not be recognized and formatted as expected.
Will this change my query's behavior?
No, only whitespace, line breaks, and keyword casing are changed - the actual query logic and identifiers are left untouched.
Is my SQL sent to a server?
No. All formatting happens locally in your browser.