MySQL SQL Formatter

Paste a MySQL query — including one copied straight out of application logs with ? placeholders still in it — and get readable, consistently formatted SQL. Backtick-quoted identifiers and MySQL-specific functions are preserved.

MySQL syntax it handles

A generic formatter mangles dialect-specific syntax or refuses it outright. These are the MySQL constructs this formatter is tested against.

?

Positional placeholders are grouped by the column and operator they sit against, so a column compared twice is filled once.

`identifier`

Backtick-quoted identifiers keep their quoting and case.

ON DUPLICATE KEY UPDATE

MySQL-only statement clauses are formatted rather than passed through as a blob.

STRAIGHT_JOIN

MySQL join hints and index hints are preserved in place.

MySQL formatter FAQ

Can I paste a query with ? placeholders straight from my logs?

Yes. That is the common case. The ? placeholders are detected and grouped by the column they compare against, so a repeated column is filled once. You can then switch the output to filled SQL to get a runnable query.

Does this work for MariaDB too?

Yes — pick MariaDB from the dialect list for MariaDB-specific keywords, or use MySQL, which covers the shared syntax.