SQL Formatter
Click the format button.
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
HTML Formatter/MinifierFree online HTML formatter that beautifies messy markup with clean indentation and line breaks, or minifies it by stripping whitespace to shrink file size, right in your browser
CSS Formatter/MinifierFree online CSS formatter and minifier that beautifies stylesheets with consistent indentation and line breaks, or strips whitespace and comments to minify CSS and reduce file size for production.
JavaScript Formatter/MinifierFree online tool that formats JavaScript code with the Prettier engine for consistent indentation and style, or minifies it by stripping whitespace and comments to reduce file size
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.