SQL Formatter
Paste SQL to format it with clean indentation and consistent keyword casing.
Paste SQL to format it with clean indentation and consistent keyword casing.
Paste a SQL query and the tool reformats it with proper indentation, line breaks, and keyword alignment. Choose uppercase, lowercase, or preserve-as-is for SQL keywords. Set your indent size to match your team's style. Works with SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, and complex queries with joins, subqueries, and CTEs.
A single-line query with five joins and three subqueries is nearly impossible to debug. Formatted SQL shows the logical structure at a glance. You can spot missing JOIN conditions, wrong WHERE clauses, and misplaced GROUP BY columns in seconds instead of minutes. It also makes code reviews faster when everyone can actually read the query.
UPPERCASE keywords (SELECT, FROM, WHERE) is the most common convention and the default here. It visually separates SQL syntax from table and column names. Some teams prefer lowercase for a less shouty look. The 'preserve' option leaves keywords as-is, which is useful when you just want indentation without changing the casing.