Skip to main content
${format:vault}

SQL Formatter

Input
Tab inserts an indent. Press Escape, then Tab, to move focus out of the editor.
Output

Why use a private SQL formatter?

The queries you most want to format are usually the ugliest ones: copied from a slow query log, an ORM debug output, or an error report. They often contain table names, schema details, and literal values — customer emails in a WHERE clause, account IDs, internal hostnames.

formatvault formats SQL entirely in your browser. The query text is never uploaded, logged, or stored, so you can safely paste production queries.

How it works

Your query is tokenised using the rules of the dialect you pick, then rebuilt with consistent indentation, line breaks after major clauses, and your chosen keyword casing. Because it understands the dialect, it keeps things like PostgreSQL casts, backtick identifiers in MySQL, and bracketed names in T-SQL intact.

Turn on the diff view to compare the original and formatted query side by side — useful for checking that only whitespace and casing changed.

Common use cases

  • Making sense of a long query copied from a slow query log or APM trace
  • Formatting ORM-generated SQL to see what your code is actually running
  • Cleaning up a query before pasting it into a pull request or a ticket
  • Enforcing consistent keyword casing across a migrations folder
  • Reviewing BigQuery or Snowflake analytics queries shared by a teammate

Frequently asked questions

Does the formatter run or connect to my database?
No. It only rewrites the text of your query. Nothing is executed, no database connection is made, and the query never leaves your browser.
Which SQL dialects are supported?
Generic SQL, PostgreSQL, MySQL and MariaDB, T-SQL (SQL Server), SQLite, BigQuery, and Snowflake. Choosing the right dialect matters for dialect-specific syntax such as identifier quoting, operators, and parameter placeholders.
Does it check whether my SQL is valid?
Only as far as formatting needs. Input that cannot be tokenised for the chosen dialect shows an error, but the formatter does not know your schema, so it cannot tell you whether a table or column exists.
Can I format several statements at once?
Yes. Statements separated by semicolons are formatted individually, with one or two blank lines between them — your choice.
Can I keep my keyword casing?
Yes. Keywords can be converted to UPPERCASE or lowercase, or left exactly as you typed them.

Related tools