SQL Formatter

Paste your SQL and click a button to beautify it with indentation, line breaks and keyword casing. Minify into one line too. Everything runs in your browser.

Last updated: 2026/10/16 Developer Feedback & bug reports
SQL Input
Formatted Result
0 Input Lines
0 Output Lines
0 Characters

How to Use

1

Paste your SQL

Type or paste the SQL you want to format into the input box. Choose a dialect and indentation if needed.

2

Click Format

Click "Format" to beautify the SQL with indentation and line breaks. Use "Minify" to collapse it into a single line.

3

Copy the result

Click "Copy" to copy the formatted SQL to your clipboard and paste it into your editor or documents.

About the SQL Formatter

The SQL Formatter beautifies hard-to-read SQL with proper indentation, line breaks and keyword casing, making the structure easy to follow. It can also minify SQL into a single line. Major dialects such as Standard SQL, MySQL and PostgreSQL are supported. You can fine-tune the dialect, the case of keywords as well as data types and functions, the indent width (2/4 spaces or tab) and even the number of blank lines between queries, so the output matches your team conventions. All processing runs entirely in your browser, so your SQL is never sent to any server—you can safely format confidential queries.

Features

  • Automatic BeautifyIndentation, line breaks and keyword casing make even long SQL easy to read at a glance.
  • Minify to One LineStrip extra whitespace and line breaks to collapse SQL into a single line for embedding or logs.
  • Major DialectsChoose Standard SQL, MySQL, PostgreSQL and more for dialect-aware formatting.
  • Fully Browser-BasedAll processing happens in your browser. Your SQL is never sent to a server—privacy protected.

Use Cases

  • Format unreadable SQL written by others to understand it
  • Expand one-line SQL embedded in logs or code to review it
  • Standardize SQL style to match your team coding conventions
  • Minify SQL into one line for embedding in programs
  • Tidy up SQL for blogs, docs and slide presentations

FAQ

Is the SQL formatter free to use?
Yes, it is completely free. No registration or installation is required—just open it in your browser and start using it.
Is my SQL sent to a server?
No. All processing, including formatting and minifying, happens entirely in your browser. Your SQL is never sent to or stored on any server, so you can safely format confidential queries.
Which database dialects are supported?
In addition to Standard SQL, major dialects such as MySQL and PostgreSQL are supported. Selecting a dialect enables formatting tailored to that syntax.
Can I standardize keywords to upper or lower case?
Yes. You can choose "UPPERCASE", "lowercase" or "Preserve" in the options to unify reserved words such as SELECT and WHERE.
Can I minify SQL into one line?
Yes. Click the "Minify" button to remove extra whitespace and line breaks and collapse the SQL into a single line—handy for embedding in code or logs.
What if formatting does not work as expected?
SQL with syntax errors or unusual proprietary extensions may not format as expected. Try changing the dialect setting or formatting the SQL in smaller parts.
Can I change the indent width or blank lines between queries?
Yes. Indentation can be 2 spaces, 4 spaces or a tab. The "Blank Lines Between Queries" option inserts empty lines between multiple statements (separated by ;), making batches easier to read. Adjust them to match your team coding conventions.
Can I also standardize the case of data types and functions?
Yes. Separately from keywords, the "Data Type & Function Case" option lets you unify type names such as INT and VARCHAR and function names such as COUNT and SUM. Choose "Preserve" to keep the original casing.