Skip to main content
SQL Formatter
SQL FormatterReady
Input Raw SQL Query
0 lines · 0 B
Raw input remains untouched until you click Format
Formatted SQL QueryEditable
0 lines · 0 B
Ready to copy (⌘⇧C) or download (⌘S)

SQL Formatter & Beautifier

Format, beautify, and indent SQL queries online. Standardize SQL keywords, clause alignment, and table joins across PostgreSQL, MySQL, and SQLite.

Keyword capitalization (SELECT, FROM, WHERE)
Indent clause alignment
Preserves string literals
Copy & Download
Step-by-Step Guide

How to Use SQL Formatter Online

Follow these quick steps to process your data online directly in your browser with zero latency and 100% privacy.

1
Step 1Tokenizes raw SQL text while preserving string literals and quotes.
2
Step 2Converts standard SQL keywords to uppercase.
3
Step 3Splits queries across major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY).
Demonstration

Example Input & Output

Capitalizes SQL keywords, indents SELECT projections, and breaks major clauses onto clean new lines.

Input Raw SQL Query
select u.id, u.name, o.total from users u left join orders o on u.id = o.user_id where o.total > 100 and u.active = 1 order by o.created_at desc limit 10;
Formatted SQL Query
SELECT
  u.id,
  u.name,
  o.total
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE o.total > 100
  AND u.active = 1
ORDER BY o.created_at DESC
LIMIT 10;
Applications

Common Use Cases

Database Query Optimization

Inspect complex nested subqueries and joins in readable layout.

Knowledge

Frequently Asked Questions

How do I format SQL online?

Paste your unformatted SQL query into the input pane; formatted SQL renders instantly.

Workflow

Related Tools

All Tools →