BTC $61,430.00 +0.78% ETH $1,715.93 +0.20% USDT $0.9990 +0.05% BNB $560.58 +0.55% USDC $0.9996 +0.03% XRP $0.9529 +3.63% SOL $72.45 +2.79% TRX $0.3105 +1.97% FIGR_HELOC $1.04 — STETH $1,723.47 +0.11% HYPE $64.29 +3.26% ZEC $785.17 −0.34% XMR $488.41 −0.73% BSC-USD $0.9988 −0.04% BTC $61,430.00 +0.78% ETH $1,715.93 +0.20% USDT $0.9990 +0.05% BNB $560.58 +0.55% USDC $0.9996 +0.03% XRP $0.9529 +3.63% SOL $72.45 +2.79% TRX $0.3105 +1.97% FIGR_HELOC $1.04 — STETH $1,723.47 +0.11% HYPE $64.29 +3.26% ZEC $785.17 −0.34% XMR $488.41 −0.73% BSC-USD $0.9988 −0.04%

SQL Formatter

Make long, messy queries readable in one click.

  • 100% Free
  • No sign-up
  • Runs in your browser

What is the SQL Formatter?

Queries copied from logs, ORMs and old code often arrive as one endless line. Paste them here and get clean SQL with each clause on its own line, joins and conditions indented and keywords in the case you like.

Pick your database so its own syntax is understood: MySQL and MariaDB backticks, PostgreSQL casts and dollar quotes, SQL Server brackets, Oracle PL/SQL, BigQuery and Snowflake. Minify does the opposite and squeezes a query into one line, keeping text inside quotes exactly as it was and removing comments.

Features

9 dialects

MySQL, MariaDB, PostgreSQL, SQL Server, SQLite, Oracle, BigQuery, Snowflake and standard SQL.

Keyword case

UPPER, lower or as you typed it.

Indent

2 spaces, 4 spaces or tabs.

Minify

One line, comments removed, strings untouched.

One-click copy

Copy the result straight into your editor.

Private

Queries never leave your browser.

How to use the SQL Formatter

  1. 1

    Paste your SQL.

  2. 2

    Pick the database, keyword case and indent.

  3. 3

    Press Format SQL, or Minify, and copy the result.

Who it is for

Debugging slow queries

Read a long query from the slow log.

Code reviews

Format SQL before you commit it.

Documentation

Paste tidy queries into wikis and tickets.

Tips for better results

  • If formatting fails, check the database choice: each dialect allows different quotes and keywords.
  • Several queries separated by semicolons are formatted one after another with a blank line between them.

Your privacy: it stays on your device

  • This tool runs entirely in your browser. What you type and the files you choose are processed on your own device and are never sent to our server.
  • Nothing is uploaded, stored or kept in a history, so it is safe for private text, documents, photos and keys.
  • It keeps working on a slow connection, because no answer has to come back from a server.

Questions people ask

Is my SQL sent to your server?

No. It is formatted by a script in your browser, so table names and data in the query stay private.

Does formatting change what the query does?

No. Only spaces, line breaks and keyword case change; names, values and strings stay exactly the same.

FREE BITCOIN TOOLS

Stuck Bitcoin transaction?

Paste your TXID, see where it stands, and give it a free push. No signup, no wallet access.

Try the free accelerator
  • Free
  • No signup
  • Live status