SQL Formatter & Beautifier
Format and minify SQL queries in six SQL dialects, with syntax highlighting.
SQL Formatter reformats SQL so each clause sits on its own line with consistent indentation. It works on anything from a single SELECT to multi-table JOINs with subqueries.
Consistent formatting makes queries easier to review and keeps diffs small when a team edits the same SQL. The tool uses the open-source sql-formatter library.
Code review
Format SQL before a review so diffs are easier to read
Documentation
Format SQL queries for technical documentation
Learning SQL
See the structure of a long query once it is indented
Query debugging
Find mistakes faster when each clause is on its own line
What SQL dialects does the formatter support?
Standard SQL, MySQL, PostgreSQL, SQLite, T-SQL (Microsoft SQL Server) and PL/SQL (Oracle). Each dialect setting accounts for differences such as quoting styles and dialect-specific keywords.
Does the SQL formatter handle complex queries?
Yes. It handles subqueries, CTEs (Common Table Expressions), JOINs, window functions and nested conditions, and indents each nested level.
What is SQL minification?
Minification removes comments and extra whitespace so the query fits on one line. Use it to embed SQL in a code string or to shrink an API payload.
Is my SQL data safe?
Yes. Formatting runs in your browser, and the tool does not send your queries to a server.
Can I use this for production SQL formatting?
Yes. The tool uses the open-source sql-formatter library. Formatting changes only whitespace and keyword case, so you can use the output in your codebase, documentation or database tools.
Private by default
The tool formats SQL in your browser and sends nothing to a server.
Related tools
JSON Formatter
Format JSON online in your browser. Paste or upload JSON to tidy it with 2 or 4 space indents, find syntax errors, minify it or browse it as a collapsible tree.
JavaScript to JSON
Convert JavaScript object literals to valid JSON
JSON Merge
Merge two JSON objects online with a deep or shallow strategy and choose how arrays combine. Useful for config files and API responses. Free, no signup.