Skip to main content

Markdown Outline Extractor

Extract a heading outline from Markdown — every ATX (#) and Setext (underline-style) heading, with its level, line number and a ready-to-use GitHub-style anchor slug for building a table of contents.

Input

Output

Result
LevelHeadingAnchorLine
No data yet
Was this helpful?

Guides

The Markdown Outline Extractor reads a Markdown document and pulls out every heading into a flat, ranked outline — the level, the text, its line number, and a ready-to-use anchor slug. It's the fastest way to build a table of contents, review a document's structure, or check that heading levels aren't skipping around.

What it extracts

Both heading styles Markdown supports are detected:

  • ATX headings — one to six # characters (# through ######), with optional trailing closing hashes (## Section ## extracts as "Section").
  • Setext headings — a line of text followed immediately by a line of = (level 1) or - (level 2) underlines.

Each result row shows the level, the heading text, a GitHub-style anchor slug (lowercased, punctuation stripped, spaces turned into hyphens, duplicates numbered — the same scheme GitHub uses for its own Markdown anchors), and the line number it appears on.

How to use it

  1. Paste your Markdown into the input box — the outline updates live as you type.
  2. Use the copy or download button to export the outline as CSV, or copy the anchor column to hand-build a table of contents.

What gets skipped

Headings inside fenced code blocks (fenced with ``` or ~~~) are ignored, since a # inside a code sample isn't a real heading. Only genuine ATX and Setext headings in the surrounding prose are extracted.

Common uses

  • Writers and documentation teams generating a table of contents for a long README or article.
  • Editors checking a document doesn't skip heading levels (jumping from # straight to ###).
  • Developers scripting a docs pipeline that needs anchor links for cross-references.
  • SEO teams auditing a page's heading structure before publishing.

Is my document private?

Yes. All extraction happens locally in your browser — your Markdown is never uploaded to a server.

Why does a duplicate heading get a "-1" suffix?

Anchor slugs must be unique on a page, so when the same heading text appears more than once, each repeat gets a numeric suffix appended (overview, overview-1, overview-2, ...) — the same convention GitHub and most static-site generators use for Markdown-rendered pages.

markdownoutlinetable of contentstocheadingsseo

More ways to use this tool

REST API

curl -X POST https://api.iotools.cloud/v1/tool/markdown-outline-extractor \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "markdown": "# Getting Started\n\nSome intro text.\n\n## Installa…"
  }'

Swap in your own key from your account. The tool's fields are the body — no wrapper.

Ask an AI agent

Use the IOTools `markdown-outline-extractor` tool (Markdown Outline Extractor) on this input:

YOUR_INPUT_HERE

Paste this at any agent connected to the IOTools MCP server, then add your input.

Embed widget

<iframe
  src="https://iotools.cloud/embed/markdown-outline-extractor/"
  width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
  title="Markdown Outline Extractor — iotools.cloud"
  sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
  allow="clipboard-write"
  style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>

Drop this into your own page — free, no key required, just a link back.

Cost per callFrom 5 credits

Also available with

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.