SQL Formatter
Guide: How to Format SQL So Anyone Can Read It
Nothing you enter or choose here leaves your device. This tool runs in your browser.
How to use
- 1Paste your SQL query into the input box.
- 2Choose your database dialect, indentation and keyword case.
- 3Read the formatted query on the right.
- 4Click Copy SQL, or switch to Minify for a single compact line.
Frequently asked questions
Which databases are supported?
Standard SQL, MySQL, MariaDB, PostgreSQL, SQL Server (T-SQL), Oracle (PL/SQL), SQLite, BigQuery, Snowflake and Redshift. Pick the dialect that matches your database so dialect-specific syntax is understood.
Will formatting change what my query does?
No. Only whitespace, line breaks and the letter case of keywords change. Table names, column names and quoted text are left exactly as you wrote them.
What does Minify do?
It removes comments and extra whitespace and puts the query on one line, while leaving the text inside quotes untouched. It is handy for logs, config files and embedding SQL in code.
Is my SQL sent anywhere?
No. Formatting runs in your browser, so queries that mention private tables or data stay on your device.
Read the guide
Learn how this works and how to get the most from it.
Developer
How to Format SQL So Anyone Can Read It
Simple formatting habits that make SQL queries easy to read and review, plus how to handle quotes and when a formatter helps.
1 min read
Related tools
JSON Formatter & Validator
Prettify, minify and validate JSON, with error line numbers.
Regex Tester
Test regular expressions live, with match highlighting and groups.
Text Diff Checker
Compare two texts side by side and see exactly what changed.
Mock Data Generator
Generate fake names, emails, dates and more as JSON, CSV or SQL.