SQL Formatter
Format and beautify SQL queries with proper indentation
Was this tool helpful?
What is SQL Formatter?
Free online SQL formatter to beautify messy or minified SQL queries into clean, readable code with proper indentation and syntax highlighting.
It supports standard ANSI SQL, MySQL, PostgreSQL, SQL Server (T-SQL), and SQLite dialects, so you can pretty print a query for the database you actually use. Customize the indentation size, uppercase the keywords, and format complex statements with subqueries, multiple joins, CTEs, and window functions. You can also minify SQL back into a single line for embedding in code. Useful for reading a query pulled from a log, cleaning up auto-generated SQL, or making a stored procedure easier to debug. All formatting runs client-side, so your queries never leave your browser. No signup required.
How to Use SQL Formatter
- 1Paste your SQL query into the input editor
- 2Select your SQL dialect and formatting preferences (indentation size, keyword casing)
- 3Click 'Format' to beautify the query with proper indentation
- 4Copy the formatted SQL or compare it side by side with the original
Frequently Asked Questions
Related Tools
XML Formatter
Free online XML formatter - format, validate, and beautify XML data with proper indentation
JSON Formatter
JSON formatter and validator online - format, beautify, and validate JSON data instantly in your browser
Code Formatter
Free online code formatter - beautify and format JavaScript, CSS, HTML, and more
CSS Formatter
Free online CSS formatter - format and beautify CSS code with configurable options
Code Screenshot
Free online code screenshot - create beautiful code screenshots with syntax highlighting
YAML ↔ JSON Converter
Free online YAML ↔ JSON converter - convert between YAML and JSON formats with validation and formatting