Dev / Text & Code / SQL Formatter

SQL Beautifier — Pretty Print & Indent SQL Online Free

Format, minify, validate SQL · Auto-detect dialect · AI explain & optimize

💡

SQL Beautifier formats unreadable or compressed SQL into clean, consistently indented code. Choose 2-space, 4-space or tab indentation, control keyword case (UPPER/lower/Title), and see the formatted output instantly. Works entirely in your browser — no upload needed.

or drag & drop .sql / .txt anywhere · max 5MB
Ctrl+M to cycle
Dialect
✦ AI
INPUT
Indent
Keywords
OUTPUT
Formatted SQL will appear here…
In: 0 chars · 0 lines·Out: 0 chars · 0 B·0ms
0 uses · 0 secondsmin saved

About SQL Formatter

SQL Beautifier formats unreadable or compressed SQL into clean, consistently indented code. Choose 2-space, 4-space or tab indentation, control keyword case (UPPER/lower/Title), and see the formatted output instantly. Works entirely in your browser — no upload needed.

Frequently Asked Questions

What is SQL Beautification?

SQL Beautification formats compressed or poorly indented SQL into readable code with consistent indentation, line breaks at each clause (SELECT, FROM, WHERE etc.), and optionally standardized keyword case.

Can I control keyword case?

Yes. Three options: UPPER (SELECT, FROM, WHERE), lower (select, from, where), or Title Case (Select, From, Where). The setting applies to all SQL keywords including JOIN types, aggregate functions, and dialect-specific keywords.

What indent options are available?

2 spaces (default), 4 spaces, or a tab character. The indent is applied to continuation lines after each major clause.

Does it handle CTEs and subqueries?

Yes. Common Table Expressions (WITH clause) and subqueries are detected and formatted with proper line breaks. CASE WHEN THEN ELSE END blocks also get individual line breaks.

Is there a file size limit for .sql files?

You can import .sql and .txt files up to 5MB via the Import File button or by dragging and dropping the file anywhere on the tool.

Ctrl+Enter FormatCtrl+M Cycle ModeCtrl+L ClearCtrl+S Download .sqlCtrl+Shift+C CopyF FullscreenP Pin? Help