SQL Formatter
Pretty-print SQL queries with consistent keyword casing.
What is the SQL Formatter?
A SQL formatter re-indents a query so its clauses, joins and nested subqueries line up visually, and normalises keyword casing. It makes a one-line query pulled from a log or an ORM readable enough to review, without changing what the query does.
Frequently asked questions
Does formatting change the results of my query?
No. Only whitespace and keyword casing change. SQL ignores both, so the formatted query is semantically identical to the one you pasted and returns exactly the same rows.
Is it safe to paste a query containing table or column names from my database?
Yes. The query is formatted locally in your browser and never transmitted, so schema details and any literal values embedded in the SQL stay on your machine.
Related Text & Code
- JSON FormatterFormat, validate and minify JSON documents.
- Text CompareDiff two blocks of text and highlight what changed.
- Case ConverterSwitch text between camel, snake, kebab, title and more.
- Common Regex PatternsA searchable library of ready-to-use regular expressions.
- HTML BeautifierBeautify or minify HTML markup.
- Code Minifier & BeautifierBeautify or minify JavaScript, TypeScript, JSON, CSS, SCSS and LESS.
SQL Formatter is one of 10 tools in Text & Code on Toolkit Hub, a free collection of browser-based utilities. It requires no account and no installation. Browse all tools.