SQL Formatter & Beautifier
Format and beautify SQL queries with proper indentation. Supports MySQL, PostgreSQL, SQLite, T-SQL, and more.
About this tool
Readable SQL is easier to understand, review, and maintain. Long, unformatted SQL queries (especially from ORM-generated code or query logs) are notoriously hard to read.
This tool reformats SQL queries with: - Keyword uppercasing (SELECT, FROM, WHERE, JOIN, etc.) - Consistent indentation for nested queries and CTEs - Newlines before major clauses - Alignment of column lists and conditions
Supported dialects: - MySQL / MariaDB - PostgreSQL - SQLite - SQL Server (T-SQL) - Oracle (PL/SQL) - BigQuery / Spark SQL (standard SQL)
Paste any SQL — from a single SELECT to complex CTEs with window functions and subqueries — and get cleanly formatted output you can read and understand at a glance.
Frequently Asked Questions
Does this work with stored procedures?
Can it format very long queries?
Does it change my query logic?
What is a CTE?
Related Tools
JSON Formatter
Format, validate, beautify, and minify JSON instantly. Syntax highlighting, error detection, and path copying. 100% client-side.
Diff Checker
Compare two texts side-by-side with highlighted differences. Supports plain text and smart JSON-aware diffing.
XML Formatter
Format and validate XML with syntax highlighting. Convert XML to JSON and JSON to XML. 100% client-side.
HTML Formatter
Format, beautify, and minify HTML. Auto-indent nested elements and collapse attributes. 100% client-side.