Developer Utility
SQL Formatter
Pretty-print SQL in your browser using the open-source SQL Formatter library, with multiple common dialect options.
Format SQL
What formatting changes
SQL formatting changes whitespace, indentation, line breaks, and optionally keyword presentation. It is intended to make queries easier to read and review. Formatting does not execute a query and does not prove that a statement is valid for a particular database.
Worked example
Input: SELECT * FROM users WHERE active = 1;
The formatter places major clauses and expressions into a more readable layout according to the selected dialect’s formatting rules.
Supported dialect choices on this page
The interface exposes generic SQL, MySQL, PostgreSQL, SQLite, and Transact-SQL. The underlying library supports additional dialects, but keeping the selector focused makes the tool easier to test and maintain.
Limitations
SQL dialects differ. Formatting is not syntax validation, query optimization, security review, or execution. The SQL Formatter project documents unsupported cases including stored procedures and changing the statement delimiter away from semicolon. Always test production SQL in the target database environment.
Privacy
The page loads the formatter library from jsDelivr, then formats the SQL client-side. The SQL text is not sent to a formatting API by this tool. Do not paste credentials or secrets into code samples unnecessarily.
Library reference
This page uses sql-formatter version 15.9.0, an MIT-licensed JavaScript SQL formatting library.
Common questions
Does formatting change what the SQL does?
The formatter is designed to change presentation rather than query intent, but any production query should still be reviewed and tested after transformation.
Does this validate SQL?
No. Formatting and syntax/database validation are different tasks.
Related tools