SQLFormatter
FormatterConvertPricingDocsGet Pro
Formatter & beautifier · MySQL

Format & beautify MySQL SQL online

Format and beautify MySQL SQL: consistent indentation, aligned clauses, uppercase keywords — and minified one-liners expanded back into readable code.

1Paste your MySQL query into the editor.
2Press Format — or ⌘↵.
3Copy clean, highlighted SQL.
Open formatter
before
select `id`,`name`,group_concat(tag) as tags from products p join tags t on t.pid=p.id where p.stock>0 group by p.id having count(t.id)>2 order by p.name limit 50;
MySQL
SELECT
  `id`,
  `name`,
  group_concat(tag) AS tags
FROM
  products p
  JOIN tags t ON t.pid = p.id
WHERE
  p.stock > 0
GROUP BY
  p.id
HAVING
  count(t.id) > 2
ORDER BY
  p.name
LIMIT
  50;

Why format MySQL?

MySQL uses backtick-quoted identifiers and functions like GROUP_CONCAT, IFNULL and LIMIT … OFFSET. The formatter recognises MySQL's grammar (and MariaDB's) so backticks and MySQL-only functions are preserved, not treated as errors.

Handy when you paste a query straight out of the MySQL general log or an ORM like Sequelize, where everything arrives on one line.

Beautify minified MySQL SQL

MySQL queries with three or four joins are common — and brutal to read when they arrive minified from slow-query logs. Beautifying breaks each JOIN and ON condition onto its own line, so you can trace how the tables connect at a glance.

Once the joins are laid out vertically it's obvious where a query is doing too much work — the first step before reaching for EXPLAIN.

minified
SELECT o.id,o.total,c.name FROM orders o JOIN customers c ON c.id=o.customer_id JOIN order_items i ON i.order_id=o.id WHERE o.created_at>'2026-01-01' AND o.status IN('paid','shipped') GROUP BY o.id ORDER BY o.total DESC LIMIT 100;
MySQL · beautified
SELECT
  o.id,
  o.total,
  c.name
FROM
  orders o
  JOIN customers c ON c.id = o.customer_id
  JOIN order_items i ON i.order_id = o.id
WHERE
  o.created_at > '2026-01-01'
  AND o.status IN ('paid', 'shipped')
GROUP BY
  o.id
ORDER BY
  o.total DESC
LIMIT
  100;

Frequently asked questions

Does the formatter understand MySQL-specific syntax?

Yes. The query is parsed against MySQL grammar rather than generic SQL, so MySQL-only constructs survive formatting: Backtick identifiers, GROUP_CONCAT, LIMIT/OFFSET.

What is the difference between formatting and beautifying MySQL SQL?

Nothing — they are two names for the same operation. "Format" usually describes tidying SQL you wrote yourself; "beautify" usually describes expanding a minified or ORM-generated one-liner into readable lines. This page does both, with a worked example of each above.

Is my SQL uploaded anywhere?

No. Formatting runs entirely in your browser — the query never leaves your machine and nothing is stored on a server.

Is the MySQL formatter free?

Yes: free, no account, no usage limit. Only the optional AI features — explain, optimize and dialect conversion — require signing in.

All SQL formatters & beautifiers

Format PostgreSQLFormat MySQLFormat T-SQLFormat SQLiteFormat BigQueryFormat OracleFormat SnowflakeFormat Redshift