🍋
Menu
🍋 Developer Tools

SQL Formatter

Format and minify SQL queries

Free Browser-only No sign-up
chars words sentences lines

Options

{# ═══════════════════════════════════════════════════════════════ DEVELOPER TOOL OPTIONS — Phase 20 (dev-* engines batch 2) ═══════════════════════════════════════════════════════════════ #}

Results

Result

About SQL Formatter

Format messy SQL queries into readable, indented code or minify formatted SQL into a single line. Supports keyword uppercasing.

How It Works

Tokenizes the SQL string and inserts line breaks and indentation after major keywords (SELECT, FROM, WHERE, JOIN, etc.). Minify mode removes extra whitespace and joins everything to one line.

Step by Step

  1. 1 Paste a SQL query in the input area
  2. 2 Choose action: Format or Minify
  3. 3 Set indentation (2 or 4 spaces)
  4. 4 Toggle keyword uppercasing
  5. 5 Click Format

Tips

  • Uppercased keywords (SELECT, FROM, WHERE) are the industry convention for readability
  • Use minify to compress SQL for URLs or configuration files
  • The formatter handles common SQL dialects including MySQL, PostgreSQL, and SQLite

Frequently Asked Questions

Which SQL dialects are supported?
The formatter works with standard SQL syntax. It handles common keywords from MySQL, PostgreSQL, SQLite, and SQL Server.
Does this validate the SQL?
No. This tool only formats the text structure. It does not parse or validate SQL syntax.