Markdown Table of Contents Generator - Turn Your Headings into a Linked TOC
Drop in your Markdown and receive a table of contents wired up with anchor links. Set how many heading levels to include and choose a bulleted or numbered style.
Loading Markdown TOC Generator...
Creating a Table of Contents from Your Markdown
Add Your Markdown
Start with any Markdown file that contains headings. It doesn't matter whether you write in GitHub-flavored Markdown, standard CommonMark, or some other flavor — the generator scans each heading level automatically:
Sample: Markdown with a Few Heading Levels
Here's some Markdown that nests its headings several levels down:
# Backpacking Handbook A short intro paragraph. ## Planning Your Route Notes on picking a trail. ### Choosing a Map Which maps to carry. ### Checking the Weather Reading the forecast. ## Packing Your Gear What to bring along.
Tune the TOC Your Way
A few controls put you in charge of how the final table of contents looks. It works nicely for GitHub README files, project documentation, and team wikis:
Take Your Finished TOC
The table of contents builds instantly, with clickable anchor links that follow proven TOC conventions. Once it's ready you can:
Sample: The TOC It Produces
This is the TOC you'd receive, with every entry linked to its heading:
# Table of Contents
- [Backpacking Handbook](#backpacking-handbook)
- [Planning Your Route](#planning-your-route)
- [Choosing a Map](#choosing-a-map)
- [Checking the Weather](#checking-the-weather)
- [Packing Your Gear](#packing-your-gear)How Heading Anchors Are Built
Each entry in the TOC points at an anchor id derived from the heading text. The slug is worked out in a fixed order, and knowing the steps makes it easy to predict exactly where a link will land:
Lowercase everything. "Getting Started" and "GETTING STARTED" both settle on the same slug.
Drop the punctuation. Periods, commas, colons, slashes, and similar symbols are removed rather than kept.
Swap spaces for hyphens. Every run of whitespace between words collapses into a single dash.
## Getting Started -> #getting-started ### API Keys & Tokens -> #api-keys--tokens #### Step 1: Install It -> #step-1-install-it
Because this mirrors the slug rules that GitHub-flavored Markdown uses, the anchors keep working when you paste your file back into a repository or wiki.
TOC Generator, Question by Question
How deep does the outline go, and can I stop it early?
You decide. The depth control walks from H1 all the way down to H6, but you can cap it wherever you like — H1 and H2 only for a tidy summary, or the full six levels when you want a granular map of a long spec. Anything below your chosen cut-off is simply skipped, so a busy document can still produce a short, scannable list.
What happens when two headings share the same name?
Repeated titles like "Examples" appearing three times are a classic gotcha, because a raw slug would collide. Following the GitHub convention, the first match keeps the plain slug and later duplicates gain a numeric suffix (#examples, then #examples-1, #examples-2), so every link still lands on the right section.
Will the anchors match the ones GitHub generates?
That's the goal. The slug format follows the same lowercase, strip-punctuation, spaces-to-hyphens recipe that GitHub, GitLab, and other CommonMark-based renderers apply, so the jump-links keep working when the file goes back into a README or wiki. If you want to eyeball the rendered result, drop it into the Markdown viewer first.
Bulleted or numbered — which one should I pick?
Whichever reads better for your doc. Flip the list-style switch to move between a bulleted layout (-) and a numbered one (1.); bullets tend to suit reference material, while numbers help when the sections are meant to be followed in order. Either way, nested headings stay indented so the hierarchy is obvious at a glance.
If I rename a heading, do I have to rebuild the TOC?
The generated block is plain Markdown, not a live link back to your document, so a TOC you copied earlier won't follow along after you rename or reorder sections. The quickest fix is to re-run the generator on the updated text and paste the fresh list in. Since it regenerates in an instant, most people just do a final pass right before publishing.
Any catch, sign-up, or usage cap?
None. Build as many tables of contents as you need with every option unlocked, no account required. When you're done here, the rest of the toolkit — the Markdown formatter and Markdown to HTML converter among them — is free the same way.
Related Tools
Markdown Viewer
View and render Markdown files online with live preview and syntax highlighting
Markdown Editor
Write and preview Markdown in real-time with live preview
Markdown Formatter
Format and beautify Markdown with consistent styling
Markdown Table Generator
Create beautiful Markdown tables with visual editor
Markdown to HTML
Convert Markdown documents to HTML with live preview and syntax support
HTML to Markdown
Convert HTML to Markdown format for documentation and content management