HelperCrate

SQL Formatter

Format SQL queries with uppercased keywords and clause line breaks.

Your files never leave your device. Everything runs in your browser.

What SQL Formatter does

SQL Formatter tidies SQL queries by uppercasing a fixed list of common keywords and placing the major clauses on their own lines. It is a quick way to make a one-line query readable before sharing it in a ticket, a document or a chat message.

The tokenizer is quote-aware: text inside single quotes, double quotes and backticks is left exactly as written, so words that look like keywords inside string literals are not changed. The formatter itself is intentionally simple and dialect-agnostic. It does not know MySQL from PostgreSQL, does not validate syntax, does not suggest indexes and never connects to a database.

A minify option collapses the query back to a single line with repeated spaces reduced, for pasting into a console or a configuration value.

How to use SQL Formatter

  1. Paste a SQL query into the input box.
  2. Click Format to uppercase keywords and break the query into clause lines.
  3. Click Minify to collapse the query to one line instead.
  4. Check the output and use Copy to take it away.
  5. Use Sample if you want to see how the formatter treats a typical select statement.

Features

Tips and common mistakes

Frequently asked questions

Does the formatter understand my database dialect?

No. It applies one keyword list and one layout rule to every dialect. Dialect-specific syntax is preserved as text but is not recognised or reformatted.

Will it validate my query?

No. It only rearranges whitespace and capitalisation. It does not parse the query grammar, check table or column names, or guarantee that the query will run.

Why are ORDER BY and GROUP BY not on their own lines?

The formatter breaks lines after single keywords, so two-word clauses are uppercased in place. Treat this as a known limit if you want fully expanded output.

Why do commas and parentheses have spaces around them?

Tokens are re-joined with spaces after formatting, so punctuation is separated from neighbouring tokens. It keeps the code valid but is not as polished as a dialect-aware formatter.

Can I run the query here?

No. There is no database connection and no execution. The tool is a text formatter only, which also means it is safe to use with private schemas.

Is my query sent anywhere?

No. Formatting happens in your browser and the query never leaves the page.

SQL is formatted locally in the browser — your queries are never sent to a server.