Developer · Free Tool
SQL Formatter
Format and beautify SQL queries for PostgreSQL, MySQL, SQL Server, BigQuery, Snowflake and more, with keyword case and indentation options.
About this tool
Paste a query, even a single long line copied from a log or an ORM, and get it back neatly formatted: one clause per line, indented joins and subqueries, and consistent keyword case. Pick the dialect so vendor-specific syntax (PostgreSQL casts, T-SQL brackets, BigQuery backticks) is understood rather than mangled.
Formatting uses the open-source sql-formatter library and runs entirely in your browser, so queries that reference real table names or contain data never leave your machine.
Common uses
- Make a long generated or logged query readable before debugging it
- Tidy queries before pasting them into code review, docs, or a ticket
- Normalise keyword case and indentation across a team's SQL files
Frequently asked questions
Does formatting change what the query does?
No. Only whitespace and keyword case change; identifiers, strings, and logic stay exactly as written. With "Keep as typed" selected, even keyword case is left alone.
Why does my query fail to format?
Usually the wrong dialect is selected or the query uses syntax that dialect does not support, such as backtick identifiers outside MySQL or BigQuery. Try the matching dialect, or Standard SQL for simple queries.
Is my data uploaded to a server?
No. This tool runs entirely in your browser using JavaScript, so nothing you type is transmitted, logged, or stored anywhere. You can even use it offline once the page has loaded.