Code Formatting

SQL Formatter

Format, compress and pretty-print SQL queries.

Input SQL
Formatted result
Formatted result will appear here

What is SQL Formatter?

SQL formatter beautifies SQL queries with proper indentation and keyword formatting, making complex queries easier to read and understand.

Features

  • Format: Beautify with indentation
  • Keyword Case: Uppercase/lowercase keywords
  • Multi-dialect: MySQL, PostgreSQL, SQL Server support

Use Cases

  • Query debugging
  • Code review
  • Documentation

Frequently Asked Questions

Does formatting execute or modify my SQL?
No. The tool parses text locally and re-prints it — no database connection, no execution. Pasting production SQL with table names or internal hosts is safe; still avoid pasting real data out of habit.
Which SQL dialects are supported?
Common syntax across MySQL, PostgreSQL, and SQLite: keyword casing, JOIN layout, subquery nesting. Dialect-specific constructs (PostgreSQL :: casts, window functions) follow the generic rules — layout only, never semantics.
Is uppercase keyword styling required?
No — it is a readability convention. SQL is case-insensitive, but uppercase keywords visually separate from lowercase identifiers, which pays off in long queries. The one-click uppercase option exists to enforce exactly this convention.