# SQL Formatter

> Format and beautify SQL queries for MySQL, PostgreSQL, SQLite, and more — with optional keyword uppercase and tab indentation.

URL: https://uttir.com/sql-formatter
Categories: developer-tools, data-tools
Privacy: Your SQL is formatted entirely in your browser. The query never leaves this page.

## About

Minified or hand-written SQL is hard to read and easy to get wrong. A few seconds of formatting turns a dense one-liner into a clearly indented, skimmable query that you can debug, review, and share with confidence.

This formatter understands the grammar of the major SQL dialects — MySQL, PostgreSQL, SQLite, MariaDB, BigQuery, and T-SQL — so keywords, joins, and subqueries are indented correctly for each. The entire formatting step runs in your browser; your queries stay private.

## How to use

1. **Paste your SQL** — Any query, however messy — the formatter handles one-liners and minified code.
2. **Pick your dialect** — Select the database flavor so reserved words and syntax are handled correctly.
3. **Tune and copy** — Toggle keyword uppercase or tab indentation, then copy the cleaned query.

## Examples

### A messy one-liner becomes readable

Formatting separates the columns, tables, and conditions onto their own lines.

Input:

```
select id,name from users where id=1 and active=true order by name desc
```

Output:

```
SELECT
  id,
  name
FROM
  users
WHERE
  id = 1
  AND active = true
ORDER BY
  name DESC
```

## FAQ

### Is my SQL sent to a server?

No. Formatting happens entirely in your browser using the sql-formatter library. Your query, which may contain sensitive schema details, never leaves the page.

### Which dialects are supported?

Generic SQL plus MySQL, PostgreSQL, SQLite, MariaDB, BigQuery, and T-SQL. Pick the closest match to your database for the most accurate formatting.

### Does it validate my SQL?

No — it is a formatter, not a validator. It will format syntactically incorrect SQL too, but the output makes errors much easier to spot.

## Related tools

- [JSON Formatter](https://uttir.com/json-formatter) — Format, beautify, and validate JSON with adjustable indentation — instantly in your browser.
- [Regex Tester](https://uttir.com/regex-tester) — Test and debug regular expressions with live matches, capture groups, and highlighted results.
- [Case Converter](https://uttir.com/case-converter) — Convert text between UPPER, lower, Title, sentence, camelCase, PascalCase, snake_case, and kebab-case.

---

For the full HTML page with the live tool, visit https://uttir.com/sql-formatter.
This file is the markdown rendering at https://uttir.com/sql-formatter.md. See https://uttir.com/llms.txt for a site-wide summary.
