Format, beautify, and standardise SQL queries instantly. Free online SQL formatter supporting MySQL, PostgreSQL, SQL Server, Oracle, and SQLite.
The Tooloogle SQL Formatter rewrites cramped, single-line, or inconsistent SQL into clean, properly indented queries you can read at a glance. Supports every major SQL dialect — MySQL, PostgreSQL, SQL Server (T-SQL), Oracle (PL/SQL), and SQLite — with dialect-specific keyword handling.
SELECT, INSERT, UPDATE, DELETE, and MERGE statements
Complex joins (INNER, LEFT, RIGHT, FULL, CROSS)
Subqueries and Common Table Expressions (CTEs)
Window functions (ROW_NUMBER(), OVER (PARTITION BY ...))
DDL statements (CREATE TABLE, ALTER, DROP, INDEX)
Stored procedures and triggers
Dialect — pick MySQL, PostgreSQL, T-SQL, PL/SQL, SQLite, Snowflake, BigQuery, or generic ANSI SQL.
Keyword case — UPPERCASE, lowercase, or preserve.
Indent size — 2, 4, or 8 spaces, or tabs.
Comma placement — trailing or leading commas in SELECT lists.
Line wrap — max line length before wrapping long expressions.
Paste your SQL into the input box.
Pick the dialect and formatting preferences.
Click Format — the cleaned-up query appears instantly.
Copy or download the result.
A formatted query reveals join structure, makes it easy to spot missing WHERE clauses, and helps reviewers catch subtle bugs (a comma after the last column, a misplaced AND). Standardised SQL also produces clean diffs in version control and makes performance tuning sessions much faster.
Formatting runs entirely in your browser. Your SQL — which often contains schema names, business logic, or sensitive filters — is never uploaded or logged.
How to Use SQL Formatter - Beautify & Format SQL Queries Online
Copy and paste your SQL query into the textarea box.
Click Format SQL to beautify it or click Minify SQL to compress into a single-line format.
Once formatted or minified, click Copy Output to instantly copy your SQL.
Format, beautify, and standardise SQL queries instantly. Free online SQL formatter supporting MySQL, PostgreSQL, SQL Server, Oracle, and SQLite.
Tool Use:
22Type:
Free ToolPrivacy:
Client SideBeautify and indent HTML markup instantly. Free online HTML formatter with custom indentation, attribute wrapping, and one-click copy — browser-based.
Beautify, indent, and tidy CSS stylesheets instantly. Free online CSS formatter with customizable indentation and selector grouping — browser-based.
Beautify, indent, and clean up JavaScript code instantly. Free online JS formatter with customizable indentation, brace style, and one-click copy.
View, format, validate, and explore JSON data with collapsible nodes, syntax highlighting, and one-click copy — free and browser-based.
Format, validate, and minify XML documents instantly. Free online XML beautifier with syntax highlighting, error detection, and one-click copy.