SQL Formatter & Minifier
Beautify SQL queries for readability, or compact to one line. This tool beautifies and minifies SQL on one page — paste your code, pick a mode, and click. Everything runs on your device, nothing is sent to a server.
Everything runs in your browser. Your code is never sent to our servers.
Example
Example Input
select a,b from t where x=1
Example Output
SELECT a, b FROM t WHERE x = 1
How to Use
- 1Choose Format or Minify mode at the top.
- 2Paste your SQL code into the Input field.
- 3If needed, set the indent width in "More settings".
- 4Click the button (or press Ctrl+Enter) to process. The result appears in the Output field.
- 5Click Copy to copy the result.
About the SQL Formatter
The SQL Formatter beautifies SQL queries with consistent keyword capitalization and clause indentation (SELECT, FROM, WHERE, JOIN), or compacts them to a single line.
How it works: Format uses the sql-formatter library which understands common SQL dialects and lays out the query for readability. Minify tightens whitespace into one line.
Clean SQL queries are far easier to read, debug, and review — especially complex queries with many JOINs and subqueries. Consistent formatting aids team collaboration.
FAQ
Can this SQL tool both format and minify?
Yes. One page with a toggle — Format mode prettifies (beautifies) with indentation, and Minify mode compacts it. No need for two separate pages.
Is my code sent to a server?
No. SQL is processed entirely in your browser using JavaScript/WebAssembly. Your code never leaves your device.