Explosion Tools

SQL Formatter Online

Format and beautify SQL queries with keyword highlighting. Free, no signup, works in your browser.

Formatted SQL will appear here…

All formatting happens in your browser. No data is sent to any server.

About SQL Formatter

This SQL formatter takes messy, single-line SQL queries and transforms them into clean, readable code with proper indentation and keyword formatting. It handles SELECT, JOIN, WHERE, GROUP BY, ORDER BY, subqueries, and common SQL constructs. The minify mode compresses formatted SQL back into a compact single-line string. Use it to clean up queries before code reviews, documentation, or debugging.

Frequently Asked Questions

What SQL dialects does this formatter support?
The formatter works with standard SQL syntax shared by MySQL, PostgreSQL, SQLite, SQL Server, and Oracle. It handles common keywords, clauses, and constructs across all major database systems.
Does it handle subqueries and CTEs?
Yes. The formatter correctly handles subqueries in parentheses, Common Table Expressions (WITH clauses), and nested SELECT statements while maintaining proper indentation.
Can I control the indentation?
Yes. Choose between 2-space or 4-space indentation. You can also toggle keyword uppercasing on or off to match your team's SQL style guide.

Related Tools