SQL Formatter
Free online SQL formatter that beautifies and indents queries. Choose 2- or 4-space indentation, uppercase keywords like SELECT and FROM, and pretty-print MySQL and PostgreSQL.
Click the format button.
Embed
Last updated: 2026 · Free online tool
What is SQL Formatter?
Free online SQL formatter that beautifies and indents queries. Choose 2- or 4-space indentation, uppercase keywords like SELECT and FROM, and pretty-print MySQL and PostgreSQL.
How to Use
- 1Enter SQL— Paste your SQL query on the left.
- 2Select options— Choose the indentation size.
- 3Format— Click the format button and the result will appear on the right.
Related Tools
JavaScript Formatter/MinifierJavaScript formatter powered by the Prettier engine for consistent indentation and style, plus a minifier that strips whitespace and comments. Free and instant in your browser, no upload, no install.
CSS Formatter/MinifierCSS formatter and minifier: beautify stylesheets with consistent indentation and line breaks, or strip whitespace and comments to shrink them. Free and instant in your browser, ready for production.
HTML Formatter/MinifierHTML formatter and minifier that beautifies messy markup with clean indentation and line breaks, or strips whitespace to shrink file size. Free and instant in your browser, nothing to install.
JSON Formatter & ViewerJSON formatter and viewer that beautifies minified or single-line JSON with proper indentation, shows it in a collapsible tree and flags syntax errors. Free and instant in your browser.
Frequently Asked Questions
Major dialects including standard SQL, MySQL, PostgreSQL, T-SQL, and PL/SQL are supported.
Yes, you can choose between 2-space or 4-space indentation.
An error message is displayed if there are syntax errors.
No. All formatting is performed in the browser.
Keywords (SELECT, FROM, etc.) are automatically converted to uppercase.