SQL Formatter
Format and minify SQL queries
Options
Results
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 Paste a SQL query in the input area
- 2 Choose action: Format or Minify
- 3 Set indentation (2 or 4 spaces)
- 4 Toggle keyword uppercasing
- 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