SQL Formatter
Formats SQL queries with proper keyword capitalization, indentation, and clause alignment for readable database operations.
Runs on sql-formatter
How to Use the SQL Formatter
Similar Tools You Might Need
See allHTML Formatter
Indents and structures HTML markup with proper nesting, attribute alignment, and readable indentation for templates and email designs.
YAML Formatter
Structures YAML configuration files with consistent indentation, proper key alignment, and readable hierarchy for Docker and CI/CD configs.
GraphQL Query Formatter
Format GraphQL queries with consistent indentation — fragments, variables, and nested selections normalized for readable, reviewable APIs.
Audio Transcript Formatter
Clean up messy audio transcript dumps into readable articles or scripts with AI — paste raw text, pick article or script format. Podcasters turn 5,000 garbled words into publishable copy — 1 credit per cleanup.
SQL to CSV Converter
Parse SQL INSERT statements back into CSV rows — quoted strings unescaped, NULLs emptied, multi-statement appends. Round-trip database dumps back to spreadsheets — local parsing, free, no signup.
Frequently Asked Questions
Which SQL dialects are supported?
MySQL, PostgreSQL, SQL Server, BigQuery, SQLite, Oracle, and Standard SQL. Each dialect applies the correct keyword syntax and function formatting.
Can I control keyword capitalization?
Yes. Choose between uppercase keywords (SELECT, WHERE, JOIN), lowercase (select, where, join), or original case. Uppercase is the most common convention.
Does it handle complex queries?
Yes. CTEs, subqueries, window functions, CASE expressions, JOINs, and nested queries are all formatted correctly with proper indentation and alignment.
Can it minify SQL instead of formatting?
Some formatters support minification. Check if this tool has a minify toggle — the primary function is pretty-printing for readability.
Is my query stored or transmitted?
No. All formatting happens locally in your browser using the sql-formatter library. No SQL is sent to any server.
Exactly how does it rewrite a query? Show one.
Only whole lowercase words from its keyword table (SELECT, FROM, WHERE, AND, OR, JOIN, ON, GROUP BY, ORDER BY, LIMIT, HAVING, UNION, VALUES, SET and more) are uppercased; every comma becomes comma-newline-2-spaces and a newline is forced before each major clause. So select a, b from t where x = 1 becomes SELECT a, then newline plus 2 spaces b, then newline FROM t, then newline WHERE x = 1.
Related Developer Tools
Code Formatter
Auto-detect language and format mixed code snippets — JS, CSS, HTML, JSON in one paste. Clean Stack Overflow answers before using — local processing, free, no signup.
JSON Formatter
Pretty-prints raw JSON with configurable indent width, key sorting, and bracket collapsing options while flagging syntax errors with exact.
CSV to SQL INSERT
Convert CSV data into SQL INSERT statements with inferred column types. Seed test databases in minutes — local conversion, free, no signup.
Last updated October 2026