Free SQL Formatter & Beautifier Online
Format, minify, and highlight SQL with keyword casing 100% in-browser
📖 SQL Quick Reference
🔍 Query
SELECT ·FROM ·WHERE ·HAVING ·GROUP BY ·ORDER BY ·LIMIT
🔗 Joins
INNER JOIN ·LEFT JOIN ·RIGHT JOIN ·FULL JOIN ·CROSS JOIN
✍️ DML
INSERT INTO ·UPDATE SET ·DELETE FROM ·MERGE ·REPLACE
🏗️ DDL
CREATE TABLE ·ALTER TABLE ·DROP TABLE ·TRUNCATE ·CREATE INDEX
📊 Aggregates
COUNT ·SUM ·AVG ·MIN ·MAX ·STRING_AGG
🪟 Window
ROW_NUMBER ·RANK ·DENSE_RANK ·LAG ·LEAD ·OVER ·PARTITION BY
🔤 Strings
UPPER ·LOWER ·TRIM ·CONCAT ·SUBSTRING ·LENGTH ·REPLACE
📅 Dates
NOW ·CURRENT_DATE ·DATE_ADD ·DATEDIFF ·EXTRACT ·DATEPART
About SQL Formatter
Looking for a free SQL formatter and beautifier online? This SQL formatter instantly formats messy SQL queries with proper indentation, keyword casing, and syntax highlighting. Supports SELECT, JOIN, INSERT, UPDATE, CREATE, and all major SQL dialects. Minify SQL to one line or beautify it for readability — no login required, 100% free and private.
Whether you are debugging a complex multi-table query or preparing SQL for documentation, this SQL beautifier makes your code clean, readable, and professionally formatted in seconds.
Works with MySQL, PostgreSQL, SQLite, SQL Server, Oracle, and most SQL dialects — all entirely in your browser.
How to Format SQL Online
- Paste your SQL query into the input box
- Choose indent size and keyword case (UPPER / lower)
- Click "Format SQL" to beautify
- Copy the formatted output or use "Minify" to compact it
Features
- Format SQL: Adds proper indentation and newlines for each clause
- Minify SQL: Strips all extra whitespace and comments to one compact line
- Keyword casing: Convert all SQL keywords to UPPERCASE or lowercase
- Syntax highlighting: Color-coded keywords, functions, strings, numbers, and comments
- SQL Quick Reference: Built-in cheat sheet for all major SQL keywords and functions
- Plain text view: Switch from highlighted to plain text for easy copying
Supported SQL Statements
- SELECT with JOINs (INNER, LEFT, RIGHT, FULL, CROSS)
- WHERE, GROUP BY, HAVING, ORDER BY, LIMIT
- INSERT INTO, UPDATE SET, DELETE FROM
- CREATE TABLE, ALTER TABLE, DROP TABLE
- CTEs (WITH clauses), subqueries, UNION
- Window functions (ROW_NUMBER, RANK, LAG, etc.)
Use Cases
- Formatting SQL for code reviews and documentation
- Debugging complex multi-table queries
- Standardizing SQL style across a team
- Minifying SQL for embedding in application config
- Learning SQL structure and syntax