About this SQL Formatter & Beautifier
This SQL formatter breaks a query into clauses: SELECT, FROM, JOIN, WHERE, GROUP BY, ORDER BY. It indents subqueries and turns keywords into uppercase. It's ideal for reading queries copied from logs, ORMs or BI tools.
Works with standard SQL used by MySQL, PostgreSQL, SQL Server, Oracle, SQLite and BigQuery.
Features
- SQL beautifier with uppercase keywords
- Indents subqueries and CTEs
- SQL minifier (single line)
- Open .sql files
How to use
- Paste your SQL query.
- Press Beautify.
- Press Minify to collapse it into one line.
- Copy the query.
Example
Before
select id,name from users where city='Kochi' order by name
After
SELECT
id,
name
FROM
users
WHERE
city = 'Kochi'
ORDER BY
name
Frequently asked questions
How do I format a SQL query online?
Paste the SQL above and press Beautify. Each clause starts on a new line and the columns are indented.
Does it work for MySQL and PostgreSQL?
Yes. Standard SQL syntax used by MySQL, PostgreSQL, SQL Server, Oracle and SQLite is supported.
More free formatters
- BeautifyAll-in-one beautifier
- JSON Beautifier & FormatterFormat & validate JSON
- XML Beautifier & FormatterPretty print XML
- HTML Beautifier & FormatterClean up HTML markup
- CSS Beautifier & FormatterFormat CSS, SCSS & LESS
- JavaScript Beautifier & FormatterBeautify JS code
- TypeScript Formatter & BeautifierFormat TS code
- YAML Formatter & ValidatorFix YAML indentation
- Markdown FormatterTidy Markdown docs
- GraphQL FormatterFormat GraphQL queries
- Text BeautifierClean up plain text