SQLFormatter
FormatterConvertPricingDocsGet Pro
Formatter · MySQL

Format MySQL SQL online

Reformat MySQL queries against MySQL's own grammar: consistent indentation, aligned clauses and uppercase keywords. Paste one-line or ORM-generated SQL and get structured, reviewable output.

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.

All SQL formatters & beautifiers

Format PostgreSQLBeautify PostgreSQL
Format MySQLBeautify MySQL
Format T-SQLBeautify T-SQL
Format SQLiteBeautify SQLite
Format BigQueryBeautify BigQuery
Format OracleBeautify Oracle
Format SnowflakeBeautify Snowflake
Format RedshiftBeautify Redshift