SQLfmt
Your SQL never leaves your browser

SQL Formatter & Beautifier

Format, beautify, and minify SQL instantly. Supports PostgreSQL, MySQL, T-SQL, PL/SQL, SQLite, BigQuery, and more — all client-side.

8 dialectsSyntax highlightingKeyboard shortcutsConfigurable optionsDownload .sql
Advertisement
INPUTpaste SQL here
OUTPUT
40120
Advertisement

How to Use the SQL Formatter

Step 1

Paste Your SQL

Paste any raw or minified SQL query into the input panel. Supports queries of any length.

Step 2

Choose Options

Select your database dialect, indentation style, keyword case, and line width preferences.

Step 3

Format or Minify

Click Format (or press ⌘↵) to beautify, or Minify to produce compact single-line SQL.

Supported SQL Dialects

DialectBest ForNotable Features
PostgreSQLApplication backends, analyticsCTEs, JSON operators, window functions
MySQLWeb applications, LAMP stackBacktick quoting, LIMIT/OFFSET syntax
T-SQLSQL Server, Azure SQLTOP clause, NOLOCK hints, square brackets
PL/SQLOracle databasesPackage syntax, procedure bodies, dual table
BigQueryGoogle Cloud analyticsBacktick identifiers, ARRAY/STRUCT types
SQLiteEmbedded, mobile appsLightweight, type affinity system
TrinoDistributed query enginesLambda expressions, connectors
Standard SQLGeneral / unknown dialectANSI-compatible across all databases

Frequently Asked Questions

Is my SQL data stored anywhere?

No. This tool is 100% client-side. Your SQL queries are processed entirely in your browser using JavaScript and are never sent to any server. Nothing is logged or retained after you close the tab.

What's the difference between Format and Minify?

Format beautifies your SQL with consistent indentation, newlines, and keyword casing — ideal for readability and code review. Minify strips comments and collapses whitespace into a single line, which minimizes size for embedding in application code or config files.

Can I format stored procedures and PL/SQL blocks?

Yes. Select the PL/SQL dialect for Oracle procedures and packages, or T-SQL for SQL Server stored procedures. The formatter understands BEGIN/END blocks, DECLARE sections, and procedural constructs.

Do my formatting preferences persist between sessions?

Yes. Your chosen dialect, indentation, keyword case, and line width are saved to localStorage and automatically restored the next time you visit.

What does the line width setting do?

Line width controls how long a line can be before the formatter wraps a clause to the next line. A lower value (e.g., 40) produces more vertical SQL; a higher value (e.g., 120) allows longer lines and is better for wide monitors.