SQL Formatter
Turn messy SQL into a readable, well-indented query, or minify it down to one compact line.
Paste your SQL below:
Result:
How to format SQL
- Paste your SQL into the input box.
- Choose whether to uppercase the keywords.
- Click Format to add line breaks and indentation, or Minify to collapse it into one line.
- Copy the result when you are satisfied.
FAQs
Is my SQL uploaded to a server?
No. Formatting runs entirely in your browser, so your query text never leaves your device.
Is this a full SQL parser?
No. It uses keyword-based rules to place line breaks and indentation. It works best on typical SELECT, INSERT, UPDATE and DELETE statements and does not check for syntax errors.
Does formatting change how my query runs?
Formatting only changes whitespace and casing, which SQL ignores, so the meaning of your query stays the same.
Is the tool free to use?
Yes. Every Handio tool is free, with no sign-up and no limits.
Related Tools
Why format SQL?
Readable SQL is easier to review, debug and hand off to a teammate. A consistent keyword layout makes a long query's structure obvious at a glance.
- Make a long query easier to scan and edit.
- Standardize the style of queries before committing them.
- Minify queries to share them compactly in code or logs.
Tips and Limits
This formatter uses simple keyword-based rules and works best on typical SELECT, INSERT, UPDATE and DELETE statements. It is not a full SQL parser and may not perfectly format deeply nested subqueries, window functions or vendor-specific syntax. Everything runs locally in your browser.