Features
Multi-dialect support
Format SQL for different database systems:- PostgreSQL - Full PostgreSQL syntax support
- MySQL - MySQL-specific formatting
- MariaDB - MariaDB syntax support
- PL/SQL - Oracle PL/SQL formatting
The formatter uses the sql-formatter library and dynamically loads it to optimize bundle size.
Format SQL
Beautify SQL with proper indentation and structure:- Configurable indentation (2 or 4 spaces)
- Keyword case formatting (UPPERCASE or lowercase)
- Line breaks between queries
- Standard indentation style
- Readable output
Minify SQL
Compress SQL to a single line:- Remove unnecessary whitespace
- Reduce query size
- Optimize for transmission
- Useful for embedding in code
Configuration options
SQL dialect
Choose the database dialect for optimal formatting:- PostgreSQL (default)
- MySQL
- MariaDB
- PL/SQL (Oracle)
Tab width
Set indentation width:- 2 spaces (default)
- 4 spaces
Keyword case
Format SQL keywords:- UPPERCASE (default) -
SELECT,FROM,WHERE - lowercase -
select,from,where
Most SQL style guides recommend UPPERCASE keywords for better readability.
Use cases
Query development
Format messy queries during development:Code review
Format SQL before committing to version control for consistency.Query optimization
Beautify complex queries to identify optimization opportunities:Documentation
Format SQL examples in documentation for better readability.Examples
The formatter includes built-in examples:Simple SELECT query
JOIN with aggregation
Multi-row INSERT
UPDATE with conditions
CTE with window function
Output feedback
The formatter provides visual confirmation:- Formatted badge - Green checkmark when formatting succeeds
- Minified badge - Indicates compressed output
- Dialect badge - Shows which SQL dialect was used
- Error alerts - Displays formatting errors if any
Copy functionality
Copy formatted SQL to clipboard:- Click the copy button on the output section
- Formatted SQL is copied with proper indentation
- Use in your code editor or database tool
Keyboard shortcuts
- Cmd/Ctrl + Enter - Format SQL
- Cmd/Ctrl + K - Clear all inputs
- Cmd/Ctrl + C - Copy formatted output
Tips
Performance
The formatter uses dynamic imports:- The sql-formatter library loads on first use
- Reduces initial page load time
- Shows loading spinner during formatting
- Optimized for large queries