Online Toolbox

DEV🎨M Code Formatter

One-click: fix indentation, keywords, and chained call formatting

Formatting options:

4-space indent (let/in, parenthesis and brace nesting) / operator spacing / collapse blank lines / preserve original keyword casing (M is case-sensitive, no rewriting). Suitable for M scripts edited in the Power Query Advanced Editor.

Power Query M Code Format

Typical scenarios: ① format M code written in the advanced editor before pasting it back into Power BI; ② unify the team's M code style; ③ tidy up code before checking it for errors.

How to use: paste your M code into the input box and click Format to unify indentation, keyword casing, and operator spacing — copy the result.

Notes: ① the indentation of `let...in` blocks is key — formatting makes the hierarchy clearer; ② comments are preserved; ③ if the code has syntax errors, formatting only beautifies and won't fix them — run the "M Code Checker" first.

Related Tools

🔄 M Code Generator M Code Checker🔀 M → DAX

Home