loot.tools

SQL Formatter

Paste messy or minified SQL and get it back with proper indentation and consistent keyword casing. Supports SELECT, INSERT, UPDATE, DELETE, CREATE, and complex queries with joins and subqueries.

Paste SQL to format it with clean indentation and consistent keyword casing.

Input SQL
Formatted SQL

What this tool does

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.

Why format SQL?

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.

Keyword casing conventions

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.

© 2026 loot.toolsYour data stays in your browser.