SQL Formatter
Paste messy SQL and get clean, properly indented output. Supports Standard SQL, MySQL, PostgreSQL, T-SQL, and PL/SQL. Configurable indentation and uppercase keywords.
How to Use the SQL Formatter
Paste your SQL query into the input field. The formatter instantly beautifies it with proper indentation and line breaks. Choose your SQL dialect (Standard SQL, MySQL, PostgreSQL, T-SQL, or PL/SQL) for dialect-specific formatting.
Adjust the indentation size (2 or 4 spaces) and toggle uppercase keywords to match your style preferences. Click Copy to copy the formatted SQL to your clipboard.
What Is SQL Formatting?
SQL formatting transforms raw, unindented SQL queries into a structured, readable format. Properly formatted SQL is easier to debug, review, and maintain. It breaks long queries into logical sections with consistent indentation for SELECT, FROM, WHERE, JOIN, and other clauses.
Different SQL databases have slightly different syntax. This formatter supports Standard SQL, MySQL, PostgreSQL, Microsoft T-SQL, and Oracle PL/SQL, ensuring correct formatting regardless of your database.
Privacy
All SQL formatting is performed locally in your browser. Your queries are never sent to any server or stored anywhere.