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.
How to Use
Paste your SQL
Type or paste the SQL you want to format into the input box. Choose a dialect and indentation if needed.
Click Format
Click "Format" to beautify the SQL with indentation and line breaks. Use "Minify" to collapse it into a single line.
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.
Working with JSON, XML or other code? The JSON Formatter and XML Formatter pair nicely with this tool. To shrink the formatted code, try the Code Minifier as well.
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?
Is my SQL sent to a server?
Which database dialects are supported?
Can I standardize keywords to upper or lower case?
Can I minify SQL into one line?
What if formatting does not work as expected?
Can I change the indent width or blank lines between queries?
Can I also standardize the case of data types and functions?
Feedback
Missing a feature, or getting a result that looks wrong? Let us know — we improve our tools based on your feedback.