Code · Made a little simpler

Markdown to YAML

Extract and validate YAML front matter, or export metadata, a heading outline with original line numbers and the Markdown body in one YAML mapping.

Free to useNo account neededProcessed on your device
Your workspaceProcessed on your device

Add this tool to your website

Paste this code into your page to add the tool and a visible ToolMellow credit link.

HTML embed code
Preview embed

Markdown to YAML: how to use it

  1. Paste Markdown, open a Markdown file or select Load example.
  2. Choose Front matter only or Document data. For document output, select the Markdown dialect used to read the heading outline.
  3. Convert, review the mapping and heading count, then copy it or download markdown-data.yaml.

Limits and notes

Accepts 160,000 UTF-16 code units and up to 2,000 parsed headings. Leading YAML front matter must contain one YAML 1.2 mapping with text keys at the top level. Document data includes the Markdown body as a string and heading text as an outline.

How your privacy works →

Markdown to YAML: common questions

How do I extract just the front matter?

Choose Front matter only. The converter reads an opening line with three dashes and a closing line with three dashes or three dots. It validates the mapping and removes the outer delimiters.

Will a long integer or a quoted identifier change?

The export retains the source spelling and type syntax of the fields in a populated mapping. For example, 9007199254740993 stays an unquoted integer and "0012" stays a quoted string.

Can I convert a Markdown document without front matter?

Yes. Choose Document data to export an empty frontmatter mapping, the heading outline and the Markdown body.

What happens to duplicate keys?

Conversion stops with a YAML mapping error. Fix the duplicate in the front matter before exporting.

Guides