Pro Every tool, icon and stickerAll of Pro for $5.99/month

  • All 85 tools
  • Festival Post Maker
  • Icon & sticker pack ZIPs
Go Pro
HubToolify
Developer Tools

SQL Formatter Pro

The query that needs formatting is rarely one you wrote by hand — it is one an ORM logged or a slow-query report coughed up as a single 900-character line. This puts it back into a shape you can argue with. Free preview · Pro required to export. Format up to 3,000 characters of SQL free. Pro removes this limit and adds downloads.

Free preview · Pro required to export. Format up to 3,000 characters of SQL free. Pro removes this limit and adds downloads.

Loading…

Why use this tool?

  • A logged query arrives as one line. Reading it is the first step to fixing it, and that step should not take five minutes of manual spacing.
  • Consistent formatting makes a query diffable, so a code review can see what actually changed.
  • Queries name your tables and often carry real values in a WHERE clause, so they are the last thing to paste into somebody else's server.

How to use SQL Formatter

  1. Paste the query.
  2. Choose the keyword case and indentation your team uses.
  3. Switch to "One line" when you need it back in a config file or a bug report.
  4. Copy it, or download it as a .sql file.

Features

  • A real tokeniser, so strings, quoted identifiers and comments are never reformatted
  • One clause per line with joins and conditions indented under them
  • Uppercase, lowercase or leave-as-typed keywords
  • Leading or trailing commas, 2 spaces, 4 spaces or tabs
  • A one-line mode for putting a query back into code
  • Counts the statements and lists the tables the query touches

Tips

  • Leading commas make it obvious when a column has been added or removed in a diff. Trailing commas read more naturally. Pick one and keep it.
  • If a line is still very long after formatting it is usually a long IN list — those read better broken by hand than by a rule.

Frequently asked questions

Which SQL dialects does it handle?

The formatting is dialect-agnostic and covers the common syntax of MySQL, PostgreSQL, SQL Server, SQLite and Oracle, including their different quoting styles — backticks, double quotes and square brackets are all recognised as identifiers.

Will it change what my query does?

No. Only whitespace and keyword case are changed, and anything inside a string literal, a quoted identifier or a comment is copied through untouched.

Is my query sent to a server?

No. It is formatted entirely in your browser.

Can I try this Pro tool without an account?

Yes. Format up to 3,000 characters of SQL free. Pro removes this limit and adds downloads. Your own input is processed locally in your browser.

Will upgrading keep my work?

Checkout and login open in a separate tab. Keep the workspace open to retain inputs, settings and previews. Files stay in that tab only; keep the originals in case you close or reload it. Export access is checked with the server after payment.

Your files are processed directly in your browser and are not uploaded to HubToolify's servers.