Back to tools
MySQL Query Formatter & Beautifier
Paste a messy or minified query and get it back with consistent indentation, keyword casing and sane line breaks — or squash it down to one line for a log line or a config value. Written for MySQL/MariaDB syntax specifically. Everything runs in your browser; nothing is uploaded.
Input
Your query
Nothing here is sent anywhere — formatting happens entirely in your browser.
Options
How to reformat it
Only real keywords are re-cased. Anything inside a string, a comment, or a `backtick`-quoted identifier is left byte-for-byte untouched.
Output
Formatted query
Formatted query
Paste a query above to see it formatted here.
This tool is tuned for MySQL/MariaDB, not PostgreSQL.Two things trip up Postgres users specifically: identifiers here are quoted with backticks (`select`), where Postgres uses double quotes ("select") and treats backticks as a syntax error; and pagination here follows MySQL's LIMIT count OFFSET start / LIMIT start, count forms, which mostly overlap with Postgres but aren't guaranteed to match its parser in every edge case. Running Postgres-flavored SQL through this formatter will tokenize fine but the dialect assumptions above are MySQL-specific.
Running your own game server?
Wespner game servers with DDoS protection, NVMe drives and activation within minutes.