SQL Formatter
Beautify and format SQL queries with proper indentation across multiple dialects.
How to use SQL Formatter
- Paste your SQL query into the input box.
- Choose the SQL dialect that matches your database.
- Choose whether keywords should be uppercased, lowercased, or left as you typed them.
- The formatted query appears instantly — copy it with the copy button.
About this tool
The SQL Formatter takes a compressed or messy SQL query and reformats it with consistent indentation, line breaks, and keyword casing, making it far easier to read and review. It supports several SQL dialects (standard SQL, MySQL, PostgreSQL, SQLite, and more), since formatting conventions and some syntax differ slightly between them. All formatting runs instantly in your browser — nothing is uploaded or sent to a server, so it's safe to use with queries containing sensitive table or column names.
Frequently Asked Questions
Why does the dialect matter?
Different databases have slightly different SQL syntax and conventions — for example, T-SQL (SQL Server) uses square brackets for identifiers while PostgreSQL uses double quotes. Choosing the matching dialect gives more accurate formatting for dialect-specific syntax.
Does this validate whether my SQL is correct?
Not fully — the formatter needs to parse enough structure to reformat the query, so badly malformed SQL may produce an error or unexpected output, but this isn't a full SQL validator or query analyzer.
Is my SQL query uploaded anywhere?
No — formatting runs entirely in your browser using a JavaScript SQL formatting library. Nothing you paste is sent to a server.