Format and beautify SQL online (MySQL, Postgres, BigQuery & more)

Turn a one-line, copy-pasted, or minified query into clean, readable SQL. Yellorn formats across the common dialects and repairs markdown fences and smart quotes first.

A query copied out of a log line, an ORM, or a chat message usually arrives as one long line — or worse, wrapped in a markdown fence with smart quotes. Yellorn pretty-prints it into clean, indented SQL with consistent keyword casing, in your browser, in one click.

  1. Paste your SQL into the editor. Yellorn auto-detects the SQL format when the text starts with a statement keyword — or pick SQL from the format selector.
  2. Press Cmd + Shift + F (Smart Format) or click Smart Format in the toolbar.

For example, this:

select id,name,email from users where active=true and created_at>'2026-01-01' order by created_at desc limit 10;

becomes this:

SELECT
  id,
  name,
  email
FROM
  users
WHERE
  active = true
  AND created_at > '2026-01-01'
ORDER BY
  created_at DESC
LIMIT
  10;
  • Smart Format (Cmd + Shift + F) repairs common paste damage first — markdown ```sql fences, smart quotes outside string literals, a byte-order mark, zero-width characters — then pretty-prints.
  • Simple Format (Alt + Shift + F) pretty-prints without the repair pass, when you want the formatter to leave your input untouched apart from layout.

The formatter handles the common-denominator grammar across MySQL, PostgreSQL, BigQuery, Snowflake, Athena (Trino), SQL Server, Oracle, and SQLite — so a query from almost any database lays out cleanly.

Everything runs locally; your query is never sent to a server. You can also convert a formatted query into a Python cursor.execute(...) snippet from the Convert to… menu.

Try a fix in the editor or browse more articles.