0x
0xkit.dev
/SQL Formatter

SQL Formatter

Format, minify and highlight SQL queries. Supports SELECT, INSERT, UPDATE, DELETE, CREATE, CTEs, window functions, and subqueries.

dialect:
indent:
UPPER
samples:
Input381 chars
Formatted
29 lines
Type
SELECT
Tables
3
Joins
2
Subqueries
0
Conditions
4
Keywords
23
Tables:usersordersaddresses
keywords functions strings numbers operators identifiers comments

About SQL Formatting

SQL formatting transforms dense, single-line queries into a structured, readable layout with proper indentation, consistent casing, and logical line breaks. This makes complex queries easier to understand, debug, and maintain — especially for queries with multiple JOINs, subqueries, or CTEs.

This formatter tokenizes SQL into keywords, identifiers, strings, numbers, operators, and comments, then applies indentation rules: major clauses (SELECT, FROM, WHERE, JOIN) start on new lines at the base level, while column lists and conditions are indented. Keywords and functions are automatically uppercased.

The query analyzer detects the statement type, referenced tables, number of JOINs, subqueries, and WHERE conditions — useful for quick complexity assessment of unfamiliar queries.

No SQL is transmitted to any server.