SQL Formatter

Format and beautify SQL queries

SQL Formatter

Format and beautify SQL queries

Features

  • Format and beautify SQL queries
  • Minify SQL for production use
  • Customizable indentation and styling
  • Support for multiple SQL dialects

How to Use

  1. 1. Paste your SQL query in the input area
  2. 2. Choose formatting options (indentation, case, style)
  3. 3. Click "Format SQL" to beautify or "Minify SQL" to compress
  4. 4. Copy the formatted result to your clipboard

SQL Formatter FAQs

Does the formatter run my query anywhere?

No. This tool is purely a formatter: it rearranges text in your browser and never connects to a database, so even queries referencing live tables are safe to paste.

Which formatting options can I control?

Indentation of 2 spaces, 4 spaces, or tabs; keyword case set to UPPERCASE, lowercase, or preserved as written; a line break before AND and OR; and an optional trailing semicolon. A style preset and a line length limit are also selectable.

What does the Minify SQL button do?

It squeezes the query onto one line by collapsing repeated whitespace and removing spaces around commas, parentheses, and equals signs, which is handy for logs, monitoring dashboards, or tight code columns.

Which keywords get case normalization?

Common SQL keywords such as SELECT, FROM, WHERE, JOIN, GROUP BY, INSERT, UPDATE, and DELETE. The stats panel additionally counts lines, characters, keywords, and table references (words following FROM or JOIN).

Are there keyboard shortcuts?

Yes. Press Ctrl and Enter to format, or Ctrl, Shift, and Enter together to minify while the cursor is in the input area.