Free SQL Formatter Online

Format messy SQL with proper indentation and keyword capitalization.

Input SQL

Formatted SQL

Formatted SQL will appear here...

How SQL Formatter works

Uses the sql-formatter library to parse and reformat SQL queries with proper indentation, keyword capitalization, and consistent spacing. Supports MySQL, PostgreSQL, SQLite, T-SQL, and BigQuery dialects. The formatter tokenizes your query, builds an AST, and outputs clean, readable SQL. Everything runs in your browser.