Format and beautify SQL queries online with proper indentation and uppercase keywords. Also minify SQL — free tool supporting SELECT, JOIN, WHERE, GROUP BY, and more.
What is SQL Formatter?
SQL Formatter is a free online tool that beautifies and formats
SQL queries with proper indentation, line breaks, and keyword
capitalization. It transforms messy, single-line, or poorly
formatted SQL into clean, readable code that is easy to review
and debug. The tool also includes a Minify mode that strips all
unnecessary whitespace and comments to produce compact SQL for
use in scripts or configurations. All formatting runs entirely
in your browser using vanilla JavaScript with no external
libraries or server calls.
When to use it?
Use the SQL Formatter when you receive a long, single-line SQL
query from a log file, ORM debug output, or a colleague's code
and need to understand its structure. It is also helpful during
code reviews when comparing SQL changes, or when documenting
queries in technical specifications and wiki pages where
readability is essential. The minify mode is useful for
embedding SQL in application code where you want to reduce
string length.
Common use cases
Database administrators and back-end developers commonly use SQL
Formatter to clean up auto-generated queries from ORMs like
Sequelize, Prisma, or Hibernate, format complex JOIN statements
with multiple WHERE conditions for debugging, prepare readable
SQL snippets for documentation and pull request descriptions,
standardize keyword casing across team codebases, and minify
stored procedures or migration scripts for deployment. It
supports common SQL keywords including SELECT, FROM, WHERE,
JOIN, GROUP BY, ORDER BY, HAVING, INSERT, UPDATE, DELETE,
CREATE, ALTER, and DROP.