# SQL Formatter

> Free SQL formatter. Format messy SQL into readable queries with uppercase keywords and indented clauses. All client-side.

Turn one-line SQL into readable queries: keywords uppercased, major clauses on their own lines, subqueries indented. Paste a messy query, get clean SQL.

*Interactive tool: enter your values at https://toollantern.win/sql-formatter/ and results update instantly in your browser.*

## What the tool does

Database tools and logs often hand you SQL as a single unreadable line. This formatter uppercases keywords (SELECT, FROM, WHERE...), puts major clauses on their own lines, indents subqueries and JOIN conditions, and breaks long column lists so you can actually read the logic.

## Worked example

select id, name from users where active = 1 order by name; becomes:

SELECT id, name
FROM users
WHERE active = 1
ORDER BY name;

## Dialects

Formatting is cosmetic and works for standard SQL across MySQL, PostgreSQL, SQLite, SQL Server and others. It does not validate your query: always test against your database.

## Frequently asked questions
### Which SQL dialects are supported?

The formatting rules are generic and work with standard SQL from MySQL, PostgreSQL, SQLite, SQL Server and Oracle. It formats text; it does not parse dialect-specific syntax.

### Does formatting change my query?

No. It only changes whitespace and keyword case. The logic, table names and values are untouched.

### Can it minify SQL too?

Not directly. The formatter is built for readability. To minify, you would collapse the formatted output back to one line, which most editors do with a join-lines command.

### Is my SQL sent to a server?

No. Formatting happens locally in your browser, so queries with table names or business logic stay private.

---
Interactive version: https://toollantern.win/sql-formatter/
