SQL Formatter
Format SQL queries with proper indentation and keyword capitalization
How it works
- 1Paste your SQL
Drop any SQL query — even messy, single-line queries.
- 2Pick indent style
Choose 2 spaces, 4 spaces, or tabs; keywords can be UPPER or lower case.
- 3Copy the result
Get a cleanly formatted query ready to paste into your editor or migration.
About SQL Formatter
Free online SQL formatter. Paste any SQL query — SELECT, INSERT, UPDATE, DDL — and get back cleanly indented output with keywords in uppercase and clauses on their own lines. Works across MySQL, PostgreSQL, SQL Server, SQLite, and BigQuery dialects. SQL Formatter on 712 Tools runs entirely inside your browser using modern JavaScript APIs — no server ever sees your data. That means instant results, complete privacy, and no upload limits.
Whether you need to format sql queries with proper indentation and keyword capitalization for a debugging session, a quick sanity check, or a production incident, this tool is free to use as many times as you need. There are no watermarks, no sign-up, and no ads inside the tool itself.
Frequently asked questions
Which SQL dialects are supported?
Standard ANSI plus dialect-specific keywords from MySQL, PostgreSQL, SQL Server, SQLite, and BigQuery. Rare vendor extensions may not indent perfectly.
Does it validate my SQL?
No. It only reformats — a syntax error in your SQL will still appear in the output. Use your database's EXPLAIN for validation.
Are comments preserved?
Yes. Both -- line comments and /* block comments */ are kept in place.
Is my query uploaded?
No. Formatting runs entirely in your browser.
Related tools
JSON Formatter
Pretty-print, minify, and validate JSON instantly
Regex Tester
Test JavaScript regular expressions with live matches
Word Counter
Count words, characters, sentences, paragraphs, reading time
Case Converter
Convert text to UPPERCASE, lowercase, camelCase, snake_case, kebab-case, and more
Lorem Ipsum
Generate placeholder text — paragraphs, sentences, or words
Text Diff
Compare two texts and highlight the differences