SQL Formatter & Beautifier

Format SQL queries with proper indentation and uppercase keywords

Input SQL

0 characters1 line

Formatted SQL

Formatted SQL will appear here...

Supported SQL Statements

SELECT

Query data with JOINs, WHERE, ORDER BY, GROUP BY, HAVING, LIMIT

INSERT

Insert data with INTO, VALUES, and column lists

UPDATE

Update records with SET and WHERE conditions

DELETE

Remove records with FROM and WHERE clauses

Common SQL Patterns

SELECT with JOIN
SELECT users.name, orders.total
FROM users
INNER JOIN orders
ON users.id = orders.user_id
INSERT
INSERT INTO users (name, email)
VALUES ('John', '[email protected]')
UPDATE
UPDATE users
SET status = 'active'
WHERE created_at > '2024-01-01'
DELETE
DELETE FROM orders
WHERE status = 'cancelled'
AND created_at < '2023-01-01'

About SQL Formatter

Our SQL Formatter is a free online tool for beautifying and formatting SQL queries. Transform messy, one-line SQL into readable, properly indented code with uppercase keywords.

Why format SQL? Well-formatted SQL is easier to read, debug, and maintain. Proper indentation and line breaks make complex queries more understandable, especially when working with JOINs, subqueries, and WHERE clauses. Clean SQL improves code reviews and team collaboration.

Features: Automatic indentation with customizable spacing (2, 4, or 8 spaces), optional uppercase keywords for SQL reserved words, proper line breaks for SELECT, FROM, WHERE, JOIN, and other clauses, and formatted comma-separated column lists. Supports all major SQL databases including MySQL, PostgreSQL, SQL Server, Oracle, and SQLite.

How to use: Paste your messy SQL query into the input area. The tool automatically formats it with proper indentation and structure. Toggle uppercase keywords and adjust indent size to match your style guide. Copy the formatted SQL with one click. Perfect for database developers, data analysts, and anyone working with SQL!