HomeToolsFormattingSQL Formatter

SQL Formatter

Format, beautify, and clean up your SQL queries with customizable casing and indentation.

Formatting
Keyword Case:
Indent:
Input SQL
Formatted SQL

What is a SQL Formatter?

A SQL formatter is a developer utility that takes raw, minified, or unorganized SQL queries and formats them into structured, readable statements. It helps in standardizing code style, making complex queries easier to read, analyze, and debug.

Features

  • Custom Indentation: Choose between 2 spaces, 4 spaces, or Tab characters.
  • Keyword Casing: Instantly convert SQL keywords to UPPERCASE, lowercase, Capitalized, or leave them in their original casing.
  • Clause Separation: Place major clauses (like SELECT, FROM, WHERE, GROUP BY, ORDER BY) on new lines for maximum readability.
  • Operator Spacing: Clean up and standardize spaces around operators (=, <, >, etc.) and commas.
  • SQL Dialects: Handles typical SQL structures including standard SELECT, JOIN, subqueries, UPDATE, DELETE, and DDL commands.

Example Input

select id,name,email from users where created_at > '2026-01-01' group by status order by created_at desc limit 10;

Example Output

SELECT
  id,
  name,
  email
FROM
  users
WHERE
  created_at > '2026-01-01'
GROUP BY
  status
ORDER BY
  created_at DESC
LIMIT 10;

Contribute

Find a bug or want to suggest an improvement to this tool?