Boneyard Tools

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

  1. Paste your SQL query into the editor.
  2. Toggle uppercase keywords on or off to match your style.
  3. 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