MySQL Formatter

Paste a MySQL query and get it laid out clause by clause — with MySQL and MariaDB syntax handled correctly.

Input · drop a file

Output

MySQL-specific syntax this formatter understands

  • Backtick-quoted identifiers like `order` are preserved
  • LIMIT … OFFSET, INTERVAL 7 DAY and GROUP_CONCAT(… SEPARATOR …) format correctly
  • ON DUPLICATE KEY UPDATE starts its own clause
  • # line comments are recognised

Formatting changes only whitespace and keyword case. What the query does is unchanged. Need another database? The main SQL formatter has 11 dialects, and the SQL minifier squeezes a query onto one line.

Questions

Is this MySQL formatter free and private?

Yes. It runs in your browser using the open-source sql-formatter library; your query is never uploaded.

Does it work for MariaDB?

Yes — MariaDB shares MySQL’s syntax for everyday queries. The main formatter page also has a dedicated MariaDB dialect.

Does it check my query against my schema?

No — it understands the syntax, not your tables. A nicely formatted query can still reference a column that doesn’t exist.

Related tools