SQL Formatter
Format and beautify SQL queries with this free online SQL formatter: clean line breaks, indentation and uppercase keywords, or minify to one line.
Processed locally in your browserHow?
This tool runs in this browser tab. The files, text and values you enter are not uploaded to clkr.work servers — closing the tab clears them. Anonymous usage events (such as which button was pressed) are counted, never your content. Privacy policy
What next?
Found it useful? Share SQL Formatter
Free, no sign-up, works in the browser — send it to a friend or add it to your site.
Related tools
- XML FormatterFormat, beautify and validate XML with this free online XML formatter. Pretty-print with spaces or tabs, minify, and see the exact line of any error.
- CSS MinifierMinify CSS with this free online CSS minifier: strip comments and whitespace safely, see bytes saved, or beautify minified CSS back into readable code.
- Binary TranslatorTranslate text to binary and binary to text with this free online binary translator, and convert numbers between binary, decimal, hex and octal.
- Cron Expression GeneratorExplain any cron expression in plain English and see the next run times. Free online cron expression generator and crontab guru alternative with presets.
- HTML Entity Encoder / DecoderEncode text to HTML entities or decode entities like & and © back to characters with this free online HTML entity encoder and decoder.
- JSON to CSV ConverterConvert JSON to CSV and CSV to JSON online free. Flattens nested objects, handles quotes and commas, opens in Excel. Free online JSON to CSV converter.
Part of the toolkit
How to use SQL Formatter
- 1Paste your SQL query into the input box
- 2Choose Beautify (with indent size and keyword case) or Minify
- 3Copy the formatted SQL or download it as a .sql file
Frequently asked questions
Which SQL dialects are supported?▾
The formatter works on standard SQL shared by MySQL, PostgreSQL, SQL Server, SQLite and Oracle — including backtick, double-quote and [bracket] identifiers, :: casts and -- or /* */ comments.
Can formatting break my query?▾
No. Only whitespace and the letter case of keywords change. String literals, identifiers, numbers and comments are copied exactly, so the query means the same thing.
How are subqueries and joins laid out?▾
Each clause (SELECT, FROM, JOIN, WHERE, GROUP BY…) starts on its own line, select columns go one per line, AND/OR conditions break onto new lines and subqueries are indented inside their parentheses.
What does minify do?▾
It removes comments and collapses the query onto a single line with minimal spaces — handy for logs, config files or embedding SQL in code.
Embed SQL Formatter on your website▾
Paste this snippet into your page. The embedded tool runs in your visitor's browser and shows a small “Powered by clkr.work” link.