inyourbrowser.com

MySQL Formatter

Format MySQL queries with the correct indentation, keyword casing, and line breaks for the MySQL dialect. Paste minified SQL and get a readable version back. All formatting runs in your browser.

Dialect:

Formatting runs entirely in your browser.

How it works

The tool uses the sql-formatter library, a dialect-aware SQL pretty-printer that runs entirely in your browser. It parses your query and re-emits it with consistent indentation and capitalisation.

Example

Input

insert into `t` (`a`) values (1) on duplicate key update `a` = `a` + 1

Formatted

INSERT INTO
  `t` (`a`)
VALUES
  (1)
ON DUPLICATE KEY UPDATE
  `a` = `a` + 1

Processing runs in your browser

All formatting happens locally in your browser tab. Our servers are not involved at any point.

Related operations

For inspecting JSON returned by queries, try the JSON formatter. To validate identifier patterns in your SQL, use the regex tester. For converting query results into structured rows, see CSV to JSON.

Frequently asked questions

Which MySQL syntax features are supported?
Standard SELECT, INSERT, UPDATE, DELETE, and JOIN forms, plus MySQL-specific constructs like backtick-quoted identifiers, LIMIT/OFFSET, and ON DUPLICATE KEY UPDATE.
What indentation does the formatter use?
Two spaces per level. Each main clause (SELECT, FROM, WHERE, GROUP BY, ORDER BY) starts a new line, with its contents indented beneath it. The width is fixed in this tool.
Can I format a script that uses DELIMITER?
Format the statements inside the procedure on their own: the sql-formatter library does not support DELIMITER changes, so a line such as DELIMITER $$ can merge with the statement next to it.
Why do function names like count() stay lowercase?
The formatter uppercases keywords such as SELECT, LEFT JOIN and ON DUPLICATE KEY UPDATE, and leaves function names and identifiers as you typed them, so count(o.id) and `user_id` keep their case.

Last reviewed September 30, 2026

Other pages for this tool

Related tools

Regex tester
Test regular expressions with a live match list, replace, and split modes. Runs in your browser.
YAML formatter
Format, validate, and convert YAML. Compatible with Kubernetes, CI configs, and OpenAPI files.
JSON formatter
Pretty-print, minify, validate, and sort JSON keys. Instant output.