Skip to content

SQL formatter

Paste a query and get a readable version with line breaks and indentation.

It works in your browser. We do not store or send anything you type.Free · No sign-up required

Workspace · SQL formatter

Runs in your browser · 100% local
Files are processed in your browser; if you are signed in with history enabled, text results appear in your history.
Instructions

How to use it

01

Paste the SQL query.

02

Press Format to add line breaks and upper-case keywords.

03

Minify if you need a single line.

Examples

Examples

Query with JOIN

SELECT u.name FROM users u JOIN orders o ON o.user_id = u.id is split across lines.

Complex WHERE

AND and OR are indented so the condition is easy to read.

Reference guide

What you need to know

The formatter recognises common SQL clauses (SELECT, FROM, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT…) and respects quoted strings. It does not execute the query or connect to any database.

Frequently asked questions

Frequently Asked Questions

It covers standard syntax and the most common MySQL, PostgreSQL and SQLite clauses.

Related tools

Other tools that can help with similar tasks.

More at Web development→
Online SQL formatter: beautify your queries · ByTooly