MDUtil

Markdown Formatter

Paste messy Markdown and get it back in one consistent style, formatted by Prettier, the formatter most editors use. Nothing is uploaded.

Markdown

268 characters21 lines

Formatted

Formatting…0 lines

How to format Markdown

  1. Paste Markdown

    Paste a README, notes or an AI answer, or open a .md file.

  2. Pick the style

    Choose whether long lines wrap and how wide they may be, and how far nested lists indent.

  3. Copy the result

    Copy the formatted Markdown or download it as a .md file.

What it handles

Prettier's rules
The result matches what Prettier writes, so it stays the same when your editor formats the file again.
One syntax for everything
Underlined headings become # headings, bullets become -, italics become _text_ and bold **text**, and lists are renumbered.
Aligned tables
Table columns are padded so the pipes line up, Chinese and Japanese text included.
Tidy spacing
Extra blank lines go, and headings, lists and code blocks get exactly one empty line around them.
Line wrapping
Keep lines as they are, wrap prose at 80 or 100 characters, or put each paragraph on one line.
Code left alone
The content of code blocks and inline code is never changed.

Format Markdown in your project

Run Prettier over every Markdown file in a folder:

npx prettier --write "**/*.md"

A .prettierrc file sets the options this page offers, such as wrapping prose at 80 characters:

{
  "proseWrap": "always",
  "printWidth": 80
}

In VS Code, install the Prettier extension and turn on Format On Save to format each file as you save it.

Questions and answers

How do I format a Markdown file?

Paste the Markdown above or open the file, then copy or download the formatted result. To format files in a project automatically, run Prettier as shown above.

Does formatting change how the Markdown renders?

No. Only the way the source is written changes, such as * bullets becoming -; the rendered page looks the same.

What does Unify syntax do?

Before Prettier runs, it rewrites elements that can be written in several ways, such as underlined headings and ~~~ code fences, in one style. Switched off, Prettier leaves underlined headings as they are.

Should I wrap long lines?

Wrapping at 80 characters makes diffs in Git easier to read. Leave lines as they are if the Markdown goes into an editor or site that shows line breaks, such as some wikis.

Is my text uploaded anywhere?

No. Prettier runs in your browser, so the Markdown never leaves your device.