SQL Formatter and Beautifier
Paste a SQL query to format it into clean, readable lines. Major clauses like SELECT, FROM, WHERE and JOIN go on their own lines, the column list is indented one item per line, and keywords are uppercased so queries are easy to scan and review.
How to format SQL
- Paste your SQL query into the editor.
- Toggle uppercase keywords on or off to match your style.
- Copy the formatted query straight into your editor or pull request.
Examples
A SELECT with a filter
select a, b from users where id = 1 and active = 1
SELECT a, b FROM users WHERE id = 1 AND active = 1
A JOIN query
select u.id from users u inner join orders o on o.user_id = u.id
SELECT u.id FROM users u INNER JOIN orders o ON o.user_id = u.id
Frequently asked questions
What does the SQL formatter do?
It rewrites a query with consistent line breaks and indentation. Each major clause (SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, LIMIT and the JOIN variants) starts a new line, the SELECT column list is indented one item per line, and AND or OR conditions break onto their own indented lines. Keywords are uppercased by default.
Which SQL dialects are supported?
It works on standard SQL and the common dialects that share that syntax, including PostgreSQL, MySQL, SQLite, SQL Server and others. It formats the structure of a query rather than enforcing any one vendor's rules, so most everyday SELECT, INSERT, UPDATE, DELETE and DDL statements format cleanly.
Does it validate or run my SQL?
No. The formatter only reshapes whitespace and keyword casing. It does not check that your query is valid, connect to a database, or run anything. Your SQL is rearranged exactly as written, including any syntax errors.
Are my strings and identifiers left alone?
Yes. Text inside single quotes, double quotes or backticks is preserved character for character, including any words that look like keywords. Only keywords outside of quotes are re-cased, and column and table names keep their original casing.
Is my query private?
Yes. Formatting happens entirely in your browser. Nothing you paste is uploaded, logged or stored on a server.
What are the limitations?
This is a lightweight structural formatter, not a full SQL parser. Very deeply nested subqueries, vendor-specific syntax and unusual operators may format more simply than a dialect-aware tool would. For everyday queries it produces clean, consistent output you can drop straight into code review.
Related tools
JSON Formatter
Format, validate and minify JSON online. Pretty-print with custom indentation, sort keys and catch syntax errors. Runs in your browser.
Diff Checker
Compare two blocks of text or code line by line. See added, removed and unchanged lines with color highlighting. Free, fast and runs in your browser.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.
Base64 Decode
Decode Base64 to plain text online. Paste a Base64 or base64url string and get instant UTF-8 output. Free, fast and runs in your browser.