MySQL Query Formatter
Format MySQL queries online with backtick identifiers and MySQL functions handled correctly. Paste your query, pick MySQL and beautify it.
Part of the free SQL Formatter. Runs in your browser — nothing is uploaded.
MySQL Query Formatter
MySQL queries often include backtick-quoted identifiers and functions like DATE_FORMAT. Choose the MySQL dialect and those are respected, giving you clean, review-ready SQL from slow-query-log lines or ORM debug output.
Worked example: Backticks and DATE_FORMAT in MySQL
Input
select id, name, date_format(created_at, '%Y-%m-%d') as day from `users` where status = 'active' order by created_at desc limit 20;
Formatted MySQL
SELECT id, name, date_format(created_at, '%Y-%m-%d') AS day FROM `users` WHERE status = 'active' ORDER BY created_at DESC LIMIT 20;
Practical tip
Copy queries from the slow query log after removing the trailing "SET timestamp" lines so only the statement itself is formatted.
How to use this SQL Formatter
- 1Use the live tool above — it runs entirely in your browser and never uploads your data.
- 2Paste the sample from the worked example, or use your own input.
- 3Copy the result, then adapt the same steps in your editor, script, or pipeline.
MySQL Query Formatter FAQs
Does it keep backtick identifiers?
Yes. Backtick-quoted table and column names are preserved exactly as written.
Does it work for MariaDB?
MariaDB is close to MySQL. Pick the MariaDB dialect for the best match, or MySQL if the query uses only common syntax.
More SQL Formatter pages
- Format SQL Query OnlineFormat SQL queries online with uppercase keywords and clean indentation. Paste a one-line query and get readable SQL instantly. Free and private.
- PostgreSQL Formatter OnlineFormat PostgreSQL queries with dialect support for JSONB operators, casts and Postgres functions. Paste SQL, choose PostgreSQL and beautify.
- SQL Server (T-SQL) FormatterFormat T-SQL for Microsoft SQL Server. Handles TOP, schema-qualified names and bracket identifiers. Paste your query and beautify it online.
- Beautify SQL JOIN QueriesFormat multi-table SQL JOIN queries so every join and ON condition sits on its own line. Paste your query and read the relationships clearly.
- Format Long SQL SELECT StatementsFormat SELECT statements with dozens of columns. Each column lands on its own line so wide queries are easy to read, edit and review.
- BigQuery SQL FormatterFormat Google BigQuery SQL with backtick project.dataset.table names. Choose the BigQuery dialect and beautify analytics queries online.
- Snowflake SQL FormatterFormat Snowflake SQL with database.schema.table names and Snowflake functions. Pick the Snowflake dialect and beautify queries online.
- Format SQL INSERT StatementsFormat multi-row INSERT INTO statements so each VALUES tuple sits on its own line. Easier to review seed data and migrations.
- SQL CTE FormatterFormat SQL queries that use WITH common table expressions. Each CTE is indented clearly so multi-step queries are easy to follow. Free and private.