Online SQL Formatter Tool

SQL beautify / minify / keyword case conversion

Input SQL
Formatted result

About SQL formatting

This tool is built on a SQL parsing library: it recognizes SELECT/FROM/WHERE/JOIN and other keywords, adds line breaks and indentation, and supports MySQL, PostgreSQL, SQL Server, BigQuery and many more dialects. When debugging API responses or SQL-backed endpoints, pair it with the HTTP Test tool to inspect the response data.

FAQ

What is SQL formatting and what does it do?

SQL formatting automatically adds indentation, line breaks and alignment to compact, hard-to-read SQL so the structure becomes clear. Formatted SQL is easier to read, debug, review and collaborate on — especially for the minified single-line SQL you often copy from logs or apps.

Which database dialects are supported?

This tool works with MySQL, PostgreSQL, SQL Server, SQLite, Oracle and other mainstream dialects. It correctly formats SELECT, INSERT, UPDATE, DELETE, CREATE TABLE and other statements, plus JOINs, subqueries and CTEs.

What is the difference between upper-case and lower-case SQL keywords?

SQL keywords are case-insensitive — SELECT and select behave identically. Industry best practice is to UPPERCASE keywords (SELECT, FROM, WHERE) and lowercase table/column names for readability. This tool converts keyword case with one click to unify your team's style.

What is the difference between formatting and compressing SQL?

Formatting breaks lines after keywords and adds indentation so the SQL hierarchy is clear. Compressing removes all extra whitespace and newlines to produce a compact single line. Format for reading and debugging; compress to reduce transfer size or embed in a code string.