SQL Formatter & Beautifier.
Format, highlight, and minify SQL — entirely in your browser.
Formatted output will appear hereWhat this tool does.
Paste any SQL query — minified API output, a one-liner from a log file, or a hand-written query with inconsistent spacing — and the formatter rewrites it with proper indentation, uppercased keywords, and newlines before each major clause. SELECT columns are listed one per line. WHERE conditions are indented under the clause. JOIN types stay at the left margin. Switch to Minify mode to do the reverse: collapse everything to a single compact line for use in code strings or API payloads.
Formatting rules.
How each clause is treated when the formatter rewrites your query.
| Rule | Example |
|---|---|
| Basic SELECT | SELECT id, name, email FROM users WHERE active = 1 |
| JOIN query | SELECT u.name, o.total FROM users u INNER JOIN orders o ON u.id = o.user_id |
| Aggregation | SELECT department, COUNT(*) AS total, AVG(salary) FROM employees GROUP BY department HAVING COUNT(*) > 5 |
| Subquery | SELECT * FROM products WHERE price > (SELECT AVG(price) FROM products) |
| INSERT | INSERT INTO logs (user_id, action, created_at) VALUES (42, 'login', NOW()) |
| UPDATE | UPDATE users SET last_login = NOW(), login_count = login_count + 1 WHERE id = 42 |
Capabilities
What You Get
Readable SQL from any input — and a one-line minifier for when it has to go back into a code string.
Clause-Aware Indentation
Newlines before each major clause, with conditions indented under it.
Keyword Casing
Reserved words are uppercased so structure reads at a glance.
One Column Per Line
Long SELECT lists become scannable instead of wrapping arbitrarily.
Syntax Highlighting
Keywords, strings, and numbers are coloured in the output.
Minify Mode
Collapse a formatted query back to one compact line.
Never Transmitted
Queries stay local — safe for schemas and production statements.
Related tools.
More free browser-based utilities, connected by category and use case.
JSON Formatter & Diff
Paste raw or minified JSON to format, validate, and syntax-highlight it. Switch to diff mode to compare two JSON blobs side by side and see exactly what changed.
JWT Decoder
Paste any JSON Web Token and instantly see the decoded header, payload, expiry, and issued-at date in a clean readable layout. Runs entirely in the browser — nothing sent anywhere.
Regex Tester
Write a regex pattern and test it against live input with real-time match highlighting, capture group labeling, and a match count. Includes a replace mode with substitution preview.
FAQ
SQL Formatter & Beautifier FAQ.
What does an SQL formatter do?
An SQL formatter takes raw or minified SQL queries and rewrites them with consistent indentation, line breaks, and keyword casing. This makes long queries readable at a glance: SELECT columns appear on separate lines, WHERE conditions are indented, and JOIN clauses are aligned at the left margin.
Why should SQL keywords be uppercase?
The SQL standard does not require uppercase, but the convention is universal across database engines, documentation, and ORMs. Uppercase keywords (SELECT, FROM, WHERE) visually separate structural tokens from identifiers and string values, making it much easier to scan a query for its logical structure.
Does formatting SQL change how the database executes it?
No. SQL is whitespace-insensitive. A minified single-line query and a beautifully formatted multi-line query produce identical query plans in every major database — PostgreSQL, MySQL, SQLite, SQL Server, and Oracle alike. Formatting is purely cosmetic.
What is SQL minification?
Minification strips all unnecessary whitespace and comments from a query, collapsing it to a single line. This is useful when embedding SQL in code strings, transferring queries over the wire, or storing them in configuration files where whitespace is irrelevant and compactness matters.
Is my SQL sent to any server?
No. This tool runs entirely in your browser using JavaScript. Your SQL never leaves your machine. There are no API calls, no logging, and no server-side processing of any kind.
Which SQL dialects does this formatter support?
The formatter handles standard ANSI SQL constructs — SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, JOIN types, GROUP BY, ORDER BY, HAVING, CASE/WHEN, and common aggregate functions. Dialect-specific syntax (PostgreSQL dollar-quoting, SQL Server square brackets, MySQL backticks) is preserved as-is without modification.













