SQL Formatter

Format SQL queries for readability: keywords are uppercased and major clauses like FROM, WHERE, JOIN and ORDER BY start on new lines. String literals are left untouched. Runs in your browser.

Formatted SQL

Readable SQL queries

The formatter uppercases SQL reserved words and breaks the query so each major clause, FROM, WHERE, GROUP BY, ORDER BY and joins, starts on its own line, with AND/OR conditions indented underneath. Text inside single-quoted string literals is left untouched, even when it contains words that look like keywords.

Formatting runs entirely in your browser; your query is never uploaded.

What this does

A SQL formatter lays out a query for readability, uppercasing keywords and breaking each major clause onto its own line.

How to use it

  1. Paste your SQL query.
  2. Format it.
  3. Read the laid-out query.
  4. Copy the result.

How it works

Reserved keywords are uppercased and clauses like FROM, WHERE, JOIN and ORDER BY start new lines, with AND/OR conditions indented. Text inside single-quoted string literals is left untouched.

Example

A one-line SELECT becomes a multi-line query with FROM and WHERE on separate lines.

Last updated .

Frequently asked questions

How does the formatter lay out a query?

It uppercases reserved keywords and breaks the query so each major clause (FROM, WHERE, GROUP BY, ORDER BY, joins) begins on its own line, with AND/OR conditions indented.

Will it change values inside my query?

No. Single-quoted string literals, quoted identifiers ("name", `name`, [name]) and comments are preserved exactly, even if they contain words that look like keywords, and a -- comment keeps its own line.

Is my SQL uploaded?

No. Formatting runs entirely in your browser; your query is never sent anywhere.