SQL Formatter

Format a single-line SQL query into readable multi-line SQL.

Formatted
SELECT id,
  name,
  email
FROM users u
JOIN orders o
ON o.user_id = u.id
WHERE u.created_at > '2025-01-01'
AND o.status = 'paid'
ORDER BY u.created_at desc
LIMIT 50
Runs entirely in your browser — nothing you paste is sent to a server.

About this tool

A fast, opinionated formatter for SELECT/INSERT/UPDATE/DELETE queries. Wraps clauses on their own lines, indents projection lists, and uppercases keywords.

How it works

  1. Paste a query — one line or many.
  2. The formatter normalises whitespace and inserts breaks before SQL keywords.
  3. Projection lists split on commas with a 2-space indent.

When to use it

  • Cleaning up a query pasted from an ORM's log.
  • Preparing a query for a blog post or slide deck.
  • Sanity-checking generated SQL from an LLM.

FAQs

Related resources