🗄️

SQL Formatter

New

Format and beautify SQL queries online — all dialects

Input SQL
Formatted SQL
SELECT u.id,
  u.name,
  COUNT(o.id) AS order_count,
  SUM(o.total) AS total_spent 
FROM users u 
LEFT JOIN orders o 
  ON u.id = o.user_id 
WHERE u.created_at > '2024-01-01' 
  AND u.status = 'active' 
GROUP BY u.id,
  u.name 
HAVING COUNT(o.id) > 0 
ORDER BY total_spent DESC 
LIMIT 50;
Browser-based, files never uploaded Instant results Works on any device

How to use SQL Formatter

  1. 1Paste SQL query
  2. 2Choose dialect (MySQL, PostgreSQL, etc.)
  3. 3Click Format
  4. 4Copy formatted SQL

About this tool

Format and beautify SQL queries online. Supports MySQL, PostgreSQL, SQLite, MS SQL Server, Oracle. Keyword highlighting and indentation.

sql formattersql beautifierformat sqlsql pretty printsql query formatter

Frequently asked questions

What SQL dialects are supported?

MySQL, PostgreSQL, SQLite, MS SQL Server, Oracle, and standard SQL.