SQL Formatter
Beautify and format SQL queries with keyword highlighting β instantly in your browser.
What is a SQL Formatter?
A SQL formatter takes raw, minified, or inconsistently written SQL and re-structures it with proper indentation, line breaks, and consistent keyword casing β making queries far easier to read, review, and debug. SQL queries written quickly or generated by ORMs often end up on a single line with mixed casing and no spacing, which makes debugging painful.
This tool formats SELECT, INSERT, UPDATE, DELETE, CREATE TABLE, ALTER, subqueries, JOINs, CTEs, and most other common SQL constructs. Keywords are highlighted in the output for readability, and you can choose between uppercase or lowercase keyword casing.
All formatting runs locally in your browser β your SQL is never sent to any server, making it safe to use with real database schemas or sensitive query logic.
How to Use
- Paste your SQL query into the left panel, or click Sample to load an example.
- The formatted output appears instantly with syntax highlighting on the right.
- Choose your preferred keyword casing: UPPERCASE, lowercase, or preserve original.
- Switch to Minify to compress the query to a single line.
- Click Copy to copy the result, or β¬ to download as a
.sqlfile.
Frequently Asked Questions
:: type cast, T-SQL's TOP, or MySQL's backtick identifiers) are preserved as-is in the output. The formatter focuses on layout and keyword casing rather than dialect-aware parsing.
select * from users and SELECT * FROM users identically. The only time output differs from input semantically is if you have a string literal like 'select' β the formatter is careful not to modify quoted string content.