💻 Developer Tools

SQL Formatter

Paste SQL and it lays out each clause on its own line with indentation. Compress to one line, or uppercase keywords, too. For SELECT, INSERT, UPDATE, DELETE, JOINs and subqueries. String and comment contents are preserved. Nothing leaves your browser.

Examples (click to try)
Paste SQL and the formatted result appears here

How to use the SQL formatter

New here? Press one of the "Examples (click to try)" chips above the input — a sample loads and the result shows right away. Then just paste SQL into the text area above. It formats live as you type. To collapse it to one line, switch to "Minify". Keyword uppercasing is a checkbox you can toggle.

Example: format a one-line query

Paste a cramped one-liner like this:

select id, name, email from users where age > 20 and status = 'active' order by name

In "Format" mode it lays out by clause (uppercase keywords on):

SELECT
  id,
  name,
  email
FROM users
WHERE age > 20
  AND status = 'active'
ORDER BY
  name

Press "Minify" to collapse the extra line breaks and spaces back to one line.

  • Format: breaks at clauses like SELECT/FROM/WHERE and indents columns and AND/OR. Subqueries are indented inside their parentheses.
  • Minify: collapses line breaks and extra spaces into one line (strings and comments preserved).
  • Uppercase keywords: uppercases only SQL keywords like SELECT, FROM, JOIN. Table and column names stay as written.

When it comes in handy

  • Making a long one-line SQL from a log or ORM readable
  • Normalizing the style of SQL across a team before review
  • Seeing the nesting of JOINs and subqueries at a glance

FAQ

Is my SQL sent to any server?
No. Formatting and minifying happen entirely within your browser, and your SQL is never sent to or stored on any server. It is safe to use even with production queries.
Which SQL dialect is supported?
It does generic, dialect-independent keyword formatting. Common syntax like SELECT, INSERT, UPDATE, DELETE, JOINs, subqueries, AND/OR and GROUP BY/ORDER BY is supported, but product-specific functions or stored procedures are not guaranteed. Treat it as a tool to make SQL readable, not a parser for a particular database.
Are string and comment contents uppercased too?
No. Single-quoted string literals, double-quoted/backtick identifiers, and -- or /* */ comments are kept as-is. Uppercasing applies only to SQL keywords.