Your data never leaves this tabRead the guide

Free SQL Formatter Online

Format messy SQL queries into clean, readable code — supports MySQL, PostgreSQL, SQL Server, and more. Runs 100% in your browser.

SQL Input
Formatted SQL

How it works

1

Paste your SQL

Paste the raw or minified SQL query into the input field.

2

Choose dialect

Select your SQL dialect: MySQL, PostgreSQL, SQL Server, etc.

3

Format

Click Format SQL or press Ctrl+Enter. The formatter indents keywords and clauses.

4

Copy and use

Copy the formatted SQL directly to your query editor or IDE.

Common use cases

Code review readability

Format auto-generated or minified SQL before reviewing a PR — properly indented queries are far easier to scan for logical errors.

Debugging complex queries

Complex JOINs and nested subqueries are nearly unreadable when compressed. Format first, then trace the logic step by step.

Documentation and wikis

Format SQL examples before embedding them in Confluence, Notion, or README files so they're readable to all team members.

ORM query inspection

ORMs like Hibernate and ActiveRecord generate verbose SQL. Format the raw output to understand what queries your app is actually running.

Frequently asked questions

Which SQL dialects are supported?

MySQL, PostgreSQL, SQL Server (T-SQL), MariaDB, SQLite, Oracle, BigQuery, Redshift, Spark SQL, Hive, and more via the sql-formatter library.

Does it validate my SQL?

The formatter reformats syntax but does not execute or validate queries. It does not check that table names, columns, or functions actually exist in your database.

Will it break my query?

No — the formatter only changes whitespace and keyword casing. The logic and values in your query are preserved exactly as you entered them.

Can I format stored procedures?

Yes — the formatter handles multi-statement SQL including stored procedures, CTEs (WITH clauses), and subqueries.

Are my queries sent to a server?

No. Formatting uses the sql-formatter library, which runs entirely in your browser. Your SQL is never transmitted anywhere.

Why does keyword casing matter?

Uppercase SQL keywords (SELECT, FROM, WHERE) are a universal convention. Most style guides and linters enforce it for readability and to distinguish keywords from identifiers.