SQL Formatter
Format raw SQL queries
SQL Formatter: Format raw SQL queries. A free, browser-based tool from DevToolbox that runs entirely on your own device: no upload, no account, no tracking.
About the SQL Formatter
Paste a query that arrived as one long line and get it back with keywords on their own lines and joins and conditions indented, so you can read what it actually does before you run it.
Formatting happens by parsing your input into a structure and printing it back out with consistent indentation, so the result is the same document with different whitespace, never a rewrite of its meaning. Invalid input is reported with the position that broke the parse rather than silently repaired.
What you can do with it
- SQL beautifier
- Format SQL online
- SQL pretty print
- MySQL formatter
- PostgreSQL formatter
How to use it
- Paste or type your code into the input pane.
- The formatted result appears in the output pane as you type. There is no run button to press.
- If the input will not parse, the status bar turns red and names the problem and its position.
- Use Copy to put the formatted result on your clipboard.
Questions
- Which SQL dialects does it handle?
- Formatting is dialect-agnostic: it works on the shape of standard SQL keywords, so MySQL, PostgreSQL, SQL Server and SQLite queries all format sensibly. It formats. It does not validate or execute anything.
- Is my data uploaded anywhere?
- No. The tool is JavaScript that runs in the tab you already have open, and DevToolbox has no backend to send anything to. You can open the network tab and watch: after the page and its script load, nothing is sent while you work.
- Does it work offline?
- Once the page has loaded, yes. The tool needs no network access to do its job, so it keeps working if your connection drops. Reloading the page does need the network unless your browser has it cached.
Related tools
The SQL Formatter sits in Beautifiers & Formatters, one of the 90 tools on DevToolbox.