SQL Formatter & Minifier

Format messy SQL into readable code or minify it into a single line for logs. Control keyword casing (UPPERCASE, lowercase or Preserve) and indentation level. Comments are kept in Format mode and stripped in Minify mode.

How to use

1

Paste your SQL

Type or paste the SQL query into the input field.

2

Choose Format or Minify

Format beautifies the query; Minify compresses it into fewer lines.

3

Set keyword casing

Choose UPPERCASE, lowercase or Preserve for keywords.

4

Copy the result

Copy the formatted or minified SQL to your clipboard.

Keyword case
Indent
SQL input
Result
SELECT u.id, u.name, u.email, COUNT(o.id) AS order_count FROM users u LEFT JOIN orders o ON o.user_id = u.id WHERE u.created_at >= '2026-01-01' AND u.status = 'active' GROUP BY u.id, u.name, u.email HAVING COUNT(o.id) > 0 ORDER BY order_count DESC LIMIT 100;

Features

Format and Minify modes

Beautify for readability, minify for size.

Keyword casing control

UPPERCASE, lowercase or Preserve — match your team's style guide.

Comment handling

Comments are kept in Format mode and stripped in Minify mode.

Adjustable indentation

Choose the indent level for formatted output.

Common use cases

  • Clean up a messy SQL query before a code review
  • Minify SQL for deployment logs
  • Standardize keyword casing across a team
  • Format a query copied from a database tool

Frequently Asked Questions

Related tools