Loading…
Free online SQL formatter with indentation and keyword casing. Format queries privately in browser.
SQL Formatter is loading — interactive editor will appear here. Use examples below to try instantly once loaded.
Press ? for keyboard shortcuts
SQL formatter supporting 11 dialects: MySQL, PostgreSQL, SQL Server, Oracle, SQLite, BigQuery, Redshift, Snowflake, DB2, MariaDB, and Standard SQL. Offers configurable keyword case (upper/lower/capitalize), comma position (leading/trailing), logical operator placement on new lines, and inline/expanded expression toggling.
SQL queries quickly become unreadable without consistent formatting. This tool enforces a unified style across teams, databases, and tools by supporting dialect-specific syntax and customizable formatting rules.
This tool is part of the DevStackIO platform — a collection of free online developer tools from DevStackIO. Browse more free developer resources on DevStackIO.
Data engineers, analysts, backend developers, and database administrators who write, review, or maintain SQL queries across multiple database platforms.
Paste or type your SQL query into the input editor.
Select a target dialect from the dropdown (MySQL, PostgreSQL, SQL Server, Oracle, SQLite, BigQuery, Redshift, Snowflake, DB2, MariaDB, or Standard SQL).
Choose keyword case: UPPER, lower, or Capitalize.
Set comma position to Leading (before column name) or Trailing (after column name).
Toggle logical operator newlines to place AND/OR at the start of each line for readability.
Click Format to generate the output; use the copy button to transfer the result to your clipboard.
Input: "SELECT id,name, email FROM users WHERE age>18 ORDER BY name" (MySQL, UPPER, trailing commas) → "SELECT id, name, email FROM users WHERE age > 18 ORDER BY name" (properly spaced and cased)Input: "SELECT a.* FROM tbl a LEFT JOIN tbl2 b ON a.id=b.id WHERE a.x=1 AND b.y=2 OR b.z=3" (PostgreSQL, lower, leading commas, AND/OR on new lines) → multi-line output with each AND/OR on its own lineDoes the formatter handle CTEs and window functions? Yes
WITH clauses, ROW_NUMBER(), RANK(), and other window functions are indented and spaced correctly.
Can I format only part of a query?
The tool formats the entire input; for partial formatting, extract the relevant subquery first.
What about DDL and DML statements?
CREATE, ALTER, INSERT, UPDATE, DELETE are all supported with proper formatting.
Does it preserve comments? Yes
single-line (--) and block (/* */) comments are preserved in the output.
Authoritative specifications, standards, and in-depth reading for SQL Formatter.
Free online JSON formatter and validator with syntax highlighting and error line numbers. Use as default for beautify+validate+minify in one place; for two-file comparison use json-diff, for schema generation use json-schema-generator. Input: JSON ≤10MB. Returns formatted JSON or line-numbered error. 100% private.
Format and validate HTML with indentation and error reporting. Use as default HTML tool; for minifying production HTML use html-minifier, for converting HTML to Markdown use html-to-markdown. Input: HTML ≤10MB. Returns formatted HTML or validation errors. 100% client-side.
Format or minify CSS with indentation control. Use as default CSS tool handling both directions; css-minifier URL is a noindex alias. Input: CSS ≤10MB. Returns formatted or minified CSS. 100% client-side.
Minify JS for production or beautify minified JS for debugging. Use for JS only; for JSON use json-formatter, for CSS use css-formatter. Input: JS text ≤10MB. Returns minified or beautified JS or syntax error. 100% client-side.
Format and validate XML with indentation and well-formedness checks. Use for XML; for JSON use json-formatter, for XML to JSON conversion use xml-to-json. Input: XML ≤10MB. Returns formatted XML or line-numbered error. 100% client-side.
Format and validate YAML with syntax checks. Use for YAML editing; for JSON to YAML conversion use json-to-yaml, for TOML/YAML/JSON cross-conversion use toml-converter. Input: YAML ≤10MB. Returns formatted YAML or error. 100% client-side.
Analyze text for word count, readability, and language stats. Paste and get instant insights.
Compare two JSON documents and highlight added, removed, and changed keys with line-level diff. Use when comparing API responses or configs; for single-document formatting use json-formatter, for validation errors use json-validator. Input: two JSON texts ≤10MB. Returns highlighted diff. 100% client-side.