SQL Formatter & Beautifier
Format, beautify, and minify SQL online. Uppercase keywords, custom indentation,...Format, beautify, and minify SQL online. Uppercase keywords, custom indentation, and 12 dialects including MySQL and PostgreSQL, all in your browser.
Updated
Formatted SQL will appear here.Quick answer
To format SQL, paste your query into the box and it beautifies live, putting each clause (SELECT, FROM, WHERE, JOIN) on its own line with clean indentation. YaliKit's SQL formatter lets you force keywords to UPPERCASE, pick 2, 4, or 8-space indent, and choose from 12 dialects like MySQL and PostgreSQL, plus a minify mode. It runs entirely in your browser, so your query stays private, and it never rewrites text inside string literals or comments.
Formatter Features
Why Use SQL Formatter & Beautifier?
Beautify Live As You Type
Paste a messy query and it reformats instantly with clause-per-line layout, aligned conditions, and clean indentation. No button to hunt for.
12 SQL Dialects
Choose Standard SQL, MySQL, PostgreSQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle (PL/SQL), BigQuery, Snowflake, Redshift, Spark, or Db2.
Keyword Casing & Indent
Force keywords to UPPERCASE (the common style guide default), lowercase, or keep them as-is. Pick 2, 4, or 8-space indentation.
Never Corrupts Your Query
Built on the sql-formatter engine, so string literals, quoted identifiers, and comments are preserved exactly. Only whitespace changes.
Minify To One Line
Switch to Minify to collapse a query onto a single compact line, safely, without touching text inside strings or comments.
100% Client-Side
Every query is formatted in your browser with JavaScript. Nothing is uploaded, so it works offline and keeps your SQL private.
Common Uses for the SQL Formatter
Code Reviews
Format SQL before opening a pull request so reviewers can read the query at a glance instead of parsing one giant line.
Query Debugging
Beautify a tangled query to spot a missing join condition, a stray AND/OR, or a mis-scoped WHERE clause quickly.
Clean Version Control Diffs
Standardize formatting before committing so diffs show real logic changes, not whitespace noise.
Docs & Tutorials
Format SQL examples for documentation, blog posts, and knowledge base articles so they read cleanly.
How It Works
Paste Your SQL Query
Drop in SQL from your editor, database client, ORM log, or anywhere. Or click Load sample to try it instantly.
Pick Dialect, Casing & Indent
Choose your database dialect, set keywords to UPPERCASE, lowercase, or keep, and select 2, 4, or 8-space indent. It reformats live as you change options.
Copy or Download the Result
Copy the formatted SQL to your clipboard with one click, or download it as a .sql file. Switch to Minify for a compact one-line version.
Tips for Formatting SQL
Use UPPERCASE for Keywords
Most SQL style guides uppercase keywords (SELECT, FROM, WHERE) so they stand out from table and column names. It is the default here.
Format Before You Commit
Run SQL through the formatter before committing so diffs stay clean and reviews focus on logic, not whitespace.
Pick the Right Dialect
Selecting your actual database (MySQL, PostgreSQL, T-SQL, and so on) formats dialect-specific syntax like backtick identifiers or casts correctly.