SQL Formatter
Format and beautify SQL queries for MySQL, PostgreSQL, SQLite, and more — with optional keyword uppercase and tab indentation.
SQL Formatter — 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.
Your SQL is formatted entirely in your browser. The query never leaves this page.
Was SQL Formatter useful?
What is sql formatter?
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 it
-
Paste your SQL
Any query, however messy — the formatter handles one-liners and minified code.
-
Pick your dialect
Select the database flavor so reserved words and syntax are handled correctly.
-
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.
select id,name from users where id=1 and active=true order by name desc
Result: SELECT id, name FROM users WHERE id = 1 AND active = true ORDER BY name DESC
Frequently asked questions
Related tools
JSON Formatter
Format, beautify, and validate JSON with adjustable indentation — instantly in your browser.
Regex Tester
Test and debug regular expressions with live matches, capture groups, and highlighted results.
Case Converter
Convert text between UPPER, lower, Title, sentence, camelCase, PascalCase, snake_case, and kebab-case.