inyourbrowser.com

SQL query formatter

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.

Dialect:

Formatting runs entirely in your browser.

How it works

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.

Processing runs in your browser

All formatting happens locally in your browser tab. Our servers are not involved at any point.

Related operations

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.

Frequently asked questions

What is the difference between SQL dialects?

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.

How do I format a PostgreSQL query?

Select 'PostgreSQL' from the dialect dropdown, paste your query, and click Format. PostgreSQL-specific keywords and syntax will be handled appropriately.

Can I use this to format stored procedures?

Yes. The formatter handles complex SQL including stored procedures, CTEs (WITH clauses), subqueries, and window functions.

Related tools

JSON formatter
Pretty-print, minify, validate, and sort JSON keys. Instant output.
Regex tester
Test regular expressions with live match highlighting, replace, and split modes.