SQL Formatter

Format and beautify SQL queries with proper indentation. Free online SQL formatter.

Runs locally in your browser
Input SQL8 lines · 220 chars
Loading editor…
Output0 lines · 0 chars
Loading editor…
Formatted SQL appears here

What is SQL Formatter?

A SQL formatter beautifies raw SQL queries with proper indentation, keyword capitalization, and line breaks. Well-formatted SQL is easier to read, review in pull requests, and debug when queries grow complex with multiple joins and subqueries.

Whether you are writing reports, reviewing database migrations, or learning SQL, a formatter transforms dense single-line queries into a clear, hierarchical structure that highlights clauses and nesting.

Our formatter supports standard SQL syntax including SELECT, INSERT, UPDATE, DELETE, JOINs, subqueries, and common functions. Everything runs in your browser for instant results.

How to Use SQL Formatter

  1. Paste your SQL query into the editor.
  2. Click Format to beautify with indentation.
  3. Review the formatted query structure.
  4. Copy or download the formatted SQL.

Features

  • Beautify SQL with consistent indentation
  • Support for SELECT, INSERT, UPDATE, DELETE, JOINs
  • Keyword-aware formatting and line breaks
  • Upload .sql files via drag-and-drop
  • Copy or download formatted queries
  • 100% client-side — queries stay private

Example

Input

SELECT u.name, COUNT(o.id) FROM users u LEFT JOIN orders o ON u.id=o.user_id GROUP BY u.name

Output

SELECT
  u.name,
  COUNT(o.id)
FROM
  users u
  LEFT JOIN orders o ON u.id = o.user_id
GROUP BY
  u.name

Frequently Asked Questions

Standard SQL including SELECT, INSERT, UPDATE, DELETE, and JOINs.