Format SQL queries for any major database system. Choose your dialect and the formatter will apply the correct indentation style and keyword casing conventions for PostgreSQL, MySQL, T-SQL, or standard SQL.
Formatting runs entirely in your browser.
The tool uses the sql-formatter library, a dialect-aware SQL pretty-printer that runs entirely in your browser. It parses your query and re-emits it with consistent indentation and capitalisation. No server required.
All formatting happens locally in your browser tab. Our servers are not involved at any point.
For inspecting JSON returned by queries, try the JSON formatter. To validate identifier patterns in your SQL, use the regex tester. For converting query results into structured rows, see CSV to JSON.
Different database systems extend standard SQL with their own syntax and functions. MySQL, PostgreSQL, and T-SQL all have differences in data types, functions, and certain syntax forms. Choosing the correct dialect ensures the formatter handles these correctly.
Select 'PostgreSQL' from the dialect dropdown, paste your query, and click Format. PostgreSQL-specific keywords and syntax will be handled appropriately.
Yes. The formatter handles complex SQL including stored procedures, CTEs (WITH clauses), subqueries, and window functions.