112 · Developer Tools

SQL Formatter

Paste a long one-line query to get a clearly laid out version you can read and review.

SQL Formatter

How to use the sql formatter

  1. Paste your SQL.
  2. Choose indentation and keyword case.
  3. Copy the formatted query.

How queries are laid out

SELECT, FROM, WHERE, GROUP BY, ORDER BY and similar clauses each start a new line. Selected columns get one line each, AND/OR conditions are indented under WHERE, joins stay on one line with their ON condition, and subqueries are indented inside their brackets. It works with MySQL, PostgreSQL, SQLite and SQL Server syntax.

Examples

select id, name from users where active = 1

SELECT id, name FROM users WHERE active = 1

count(o.id)

COUNT(o.id)

Questions

Does it check that my SQL is valid?

No. It formats whatever you paste; it doesn’t run or validate the query against a database.

Is my data uploaded?

No. Everything runs in your browser, so what you paste never leaves your device.