Format, minify, and syntax highlight SQL queries. Supports MySQL, PostgreSQL, SQL Server, Oracle, and SQLite.
Type or paste your SQL query into the text area above.
Select the SQL dialect (MySQL, PostgreSQL, etc.), indentation style, and keyword case preference.
Click 'Format' for readable output or 'Minify' to compress into a single line. Copy the result to use.
Result will appear here
SQL Formatter is an online tool that automatically formats SQL queries into a readable structure. It helps you understand complex query structures and prepare SQL for code reviews. It supports five major SQL dialects: MySQL, PostgreSQL, SQL Server, Oracle, and SQLite, providing optimized formatting for each database's syntax.
Each database has specific keywords and syntax. For example, MySQL's "LIMIT" vs SQL Server's "TOP". Selecting the correct dialect ensures optimal formatting according to each syntax.
A feature that unifies SQL keywords (SELECT, FROM, WHERE, etc.) to uppercase or lowercase. Choosing "Preserve" keeps the original case. Select according to your team's coding conventions.
Format adds indentation and line breaks to make SQL human-readable. Minify does the opposite - it removes unnecessary whitespace and newlines, compressing everything to a single line. Minify is useful for log output or embedding in configuration files.
Basic formatting is possible, but results may not be as expected. If there are syntax errors, we recommend fixing them before formatting.
No, all processing happens entirely in your browser. Your input data is never sent to any server. You can safely use this tool with sensitive queries.