Skip to content
Case Converter Online
en

Markdown Formatter

Paste Markdown to tidy lists, emphasis, spacing and tables in one pass. It uses the same rules as Prettier, so the result matches what your editor would produce.

Paste Markdown or press Sample. Press Ctrl and Enter to format. Everything runs in your browser.

What a Markdown formatter does

Markdown is forgiving. You can write a bullet with -, * or +, emphasis with * or _, and a heading with a row of equals signs or with #. That freedom is handy when you type, but a file edited by several people soon mixes every style. Tables drift out of line, blank lines go missing and diffs get noisy.

This formatter rewrites the source in one consistent style. It is built on Prettier, the formatter most JavaScript projects already use for their docs, so the output matches what Prettier gives in VS Code or on the command line.

How to use it

  1. Paste your Markdown into the left box, or press Open file to load a .md file. Pasting formats it straight away.
  2. Press Sample if you want to see an example first.
  3. Pick the Indent, the Line width and how to Wrap text: Keep as is, At line width or One line per paragraph.
  4. Press Format (or Ctrl and Enter) to run it again after you change something.
  5. Use Copy or Download to take the result. Clear empties the input.

Once you have formatted once, the output follows along as you type.

Before and after

Here is a short file written in a mixed style:

Project Notes
=============
* Install the tools
* Run the build
+ Deploy

|Name|Role|
|-|-|
|Ada|Admin|
|Linus|Editor|

Some *emphasis* and __bold__ text.

The formatter returns:

Project Notes
=============

- Install the tools
- Run the build

* Deploy

| Name  | Role   |
| ----- | ------ |
| Ada   | Admin  |
| Linus | Editor |

Some _emphasis_ and **bold** text.

A few things happened. A blank line now follows the heading. The first list uses -. Bold uses ** and italic uses _. The table columns are padded so they line up in plain text. Notice that “Deploy” stayed apart: it used a different bullet, so Markdown treats it as a second list, and the formatter keeps that meaning by giving it a different marker.

Wrapping long paragraphs

With Wrap text set to At line width and a line width of 60, this paragraph:

Markdown files are easier to review when each paragraph follows the same rule for line length, because a diff then shows only the sentence that changed.

becomes:

Markdown files are easier to review when each paragraph
follows the same rule for line length, because a diff then
shows only the sentence that changed.

One line per paragraph does the reverse and joins wrapped lines back together. Keep as is is the safe default when you do not know what your team expects.

What it leaves alone

The formatter changes layout, not meaning. Some things it deliberately does not touch:

  • Code blocks. Code inside a fenced block stays exactly as written. A block marked js that contains const a={b:1} is not reformatted. Use the JavaScript formatter for that.
  • Numbered lists. If every item starts with 1., it keeps 1. on every line. If you numbered them 1, 2, 3, it keeps that.
  • Text that is not valid syntax. #Title without a space is not a heading in CommonMark, so it stays a plain paragraph. Add the space and it becomes a heading.
  • Inline HTML. HTML tags inside your Markdown are kept as they are.

Tips

  • Format before you commit. Consistent files mean the diff in a pull request only shows real edits.
  • Pick one wrap rule for a whole repository. Mixing wrapped and unwrapped files causes large diffs the first time someone formats them.
  • Building a table by hand is slow. The Markdown table generator gives you a grid to type in and pastes from spreadsheets.
  • Need Markdown from a web page or a Word file? Use the HTML to Markdown converter or the Word to Markdown converter, then tidy the result here.

Other ways to format Markdown

  • VS Code: install the Prettier extension, open a .md file and run Format Document. The output matches this page.
  • Command line: npx prettier --write README.md formats a file in place. Add --prose-wrap always to wrap paragraphs.
  • Linting: markdownlint checks style rules such as heading levels and line length. It reports problems, while a formatter fixes layout for you. Many projects use both.

Limits

The formatter follows CommonMark with GitHub extensions such as tables and task lists. Extensions from other tools, like custom containers or wiki links, are treated as plain text and may be spaced differently from what that tool expects. Front matter at the top of a file (the block between two --- lines) is kept. Very large files work, but formatting takes longer because it all happens on your device.

Markdown Formatter: questions and answers

Does formatting change how my Markdown renders?

No. The formatter only changes how the source is written: list markers, emphasis markers, blank lines and table padding. The rendered page looks the same. Code inside fenced code blocks is left exactly as you wrote it.

Why did my list split into two lists?

In Markdown, switching the bullet character starts a new list. If you mix * and + in one list, the formatter keeps them as two separate lists, because that is how Markdown reads them. Use the same marker for every item if you want one list.

What does the Wrap text option do?

Keep as is leaves your line breaks alone. At line width wraps paragraphs at the chosen Line width. One line per paragraph joins each paragraph onto a single line, which many people prefer for Git diffs.

Is my text uploaded anywhere?

No. The formatter runs in your browser. Your Markdown is not sent to a server, so it is safe to use with private notes and internal docs.

More code and data tools

See all tools