About this tool
The SQL Formatter turns cramped, one-line or inconsistently-styled SQL into clean, readable queries. It is powered by the battle-tested sql-formatter engine and understands 11 dialects — Standard SQL, PostgreSQL, MySQL, MariaDB, SQLite, SQL Server (T-SQL), Oracle (PL/SQL), BigQuery, Redshift, Spark SQL and Snowflake — so keywords, functions, data types and identifier quoting are handled the way your database expects.
Unlike a one-size-fits-all beautifier, every stylistic choice is yours: force keywords, data types, functions and identifiers to uppercase, lowercase or preserve them; pick the indent width or use tabs; switch between standard and tabular indentation; place AND/OR at the start or end of lines; and tune the expression width that controls when long clauses wrap. Turn on auto-format to reformat as you type, or use Minify to collapse a query onto a single line.
Everything runs locally in your browser — no query is ever uploaded, so it's safe for production SQL. Need to review a change instead of tidy one query? Switch to the Compare tab to diff two queries side by side.
How to use
Paste and format
Paste SQL into the Input pane. With Auto-format on it reformats instantly; otherwise click Format. The result is syntax-highlighted in the Output pane.
Match your database dialect
Choose the dialect (e.g. PostgreSQL or BigQuery) so dialect-specific keywords and quoting format correctly.
Tune the style
Set keyword/identifier casing, indent width, tabular indentation and logical-operator placement until the output matches your team's style guide.
Copy, download or minify
Copy the formatted SQL, download it as a .sql file, or click Minify to collapse it to a single line for embedding in code.
Key formatting options
| Option | What it does |
|---|---|
| Dialect | Parse rules for 11 databases (PostgreSQL, MySQL, T-SQL, BigQuery, …) |
| Keyword / type / function / identifier case | Force UPPERCASE, lowercase or preserve — independently |
| Indent width & tabs | Spaces per level, or use tab characters |
| Indent style | Standard, or tabular (aligned) left/right |
| Logical operator newline | Put AND/OR before (line start) or after (line end) |
| Expression width | Column budget before long expressions wrap |
| Minify | Collapse to one line, stripping comments and extra whitespace |
All processing is client-side — your SQL never leaves the browser.
Frequently asked questions
Related tools
Base64 Encoder/Decoder
Advanced Base64 encoder/decoder with auto-detection, multiple formats (URL-safe, MIME, Data URI), file support, and comprehensive statistics.
CSV to Chart
Paste or upload CSV data and generate bar, line, pie, or doughnut charts. Export as PNG.
CSV to JSON Converter
Paste CSV data and convert it to pretty-printed JSON instantly — supports custom delimiters, header row toggling, and value trimming.
Diff Checker
Compare two text blocks and highlight differences side-by-side
GraphQL Formatter & Validator
Format, validate and beautify GraphQL queries with syntax highlighting
HTML Encoder/Decoder
Encode and decode HTML entities. Convert special characters to HTML entities and back. Perfect for displaying code safely in HTML.