aicores.io

SQL Formatter

Paste your SQL query below to format it with proper indentation and uppercase keywords, or minify it to a single line.

About SQL Formatter

This free online SQL formatter helps you prettify and clean up SQL queries instantly in your browser. No data is sent to any server — everything runs locally. It uppercases SQL keywords, adds newlines before major clauses, and indents sub-clauses like AND and OR for improved readability. Supports SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, and other common statements.

How to Use

  1. Paste or type your SQL query into the input area on the left.
  2. Click Format to prettify the SQL with uppercase keywords, newlines, and indentation.
  3. Click Minify to collapse the query to a single line with normalized whitespace.
  4. Click Copy to copy the output to your clipboard.

Frequently Asked Questions

Which SQL dialects are supported?

The formatter handles standard SQL syntax that is common across most databases including MySQL, PostgreSQL, SQLite, SQL Server, and Oracle. It focuses on keyword formatting and indentation rather than dialect-specific features.

Does this tool validate my SQL?

No, this tool formats SQL for readability but does not validate syntax or check for errors. It will format whatever input you provide, regardless of whether it is valid SQL.

Are string literals preserved?

Yes. Single-quoted strings and double-quoted identifiers are preserved as-is. The formatter will not modify content inside quotes or incorrectly uppercase text within string literals.

What does minify do?

Minify collapses the entire query to a single line and normalizes all whitespace to single spaces. This is useful when you need a compact query for logging, configuration files, or embedding in code.

Related Tools