Bytelify

SQL Formatter & Beautifier

Format and indent SQL queries into clean, readable syntax, live as you type, across multiple dialects.

Runs in your browser, nothing sent
sql-formatter-and-beautifier
Formatted

Formats live as you type, entirely in your browser. Nothing you type is sent anywhere.

Need the opposite? SQL Minify

What is SQL Formatter & Beautifier?

Paste a compressed or messily-formatted SQL query and get it reformatted with consistent indentation and capitalized keywords, powered by the sql-formatter library. Supports standard SQL plus MySQL, PostgreSQL, SQLite, and MariaDB dialect quirks.

How to Use the SQL Formatter

  1. 1

    Paste the SQL Query: Enter a compressed or messily-formatted query.

  2. 2

    Choose a Dialect: Pick standard SQL, MySQL, PostgreSQL, SQLite, or MariaDB to match your database.

  3. 3

    Read the Formatted Result Instantly: The indented, keyword-capitalized query appears automatically as you type.

  4. 4

    Copy the Result: Use the copy button to copy the formatted query.

How It Works

The sql-formatter library tokenizes your query and re-prints it with consistent indentation and line breaks around major clauses (SELECT, FROM, WHERE, JOIN, GROUP BY, ORDER BY, and similar), capitalizing keywords and putting each selected column or condition on its own indented line so the query's structure is readable at a glance.

Example

Before
select id,name,email from users where active=1 and role='admin' order by name;
After
SELECT
  id,
  name,
  email
FROM
  users
WHERE
  active = 1
  AND role = 'admin'
ORDER BY
  name;

Keywords capitalize, and each selected column and condition moves to its own indented line under its clause.

Common Use Cases

Turning a compressed query pulled from a slow-query log or an ORM's debug output into something reviewable in a pull request, or standardizing formatting style across a team that writes SQL by hand in migrations and reports.

FAQs

Frequently Asked Questions

Common questions about SQL Formatter & Beautifier.

Standard SQL, MySQL, PostgreSQL, SQLite, and MariaDB. Pick the dialect that matches your database from the dropdown for the most accurate formatting.

No, this only reformats the text of your query. It never connects to a database or executes anything.

Yes, use the paired SQL Minify tool for the reverse direction.

Yes, Bytelify's SQL Formatter & Beautifier is free with no account or sign-up required.

No. Formatting runs entirely client-side in your browser, so your query is never sent anywhere.