Markdown TOC generator — paste your markdown, get a clean table of contents with anchor links.
- Runs locally
- Category Format Converter
- Best for Turning pasted content or local files into a handoff-friendly format.
- [Project](#project)
- [Install](#install)
- [macOS](#macos)
- [Linux](#linux)
- [Usage](#usage)
- [API](#api)
- [init()](#init)
- [run()](#run)
- [License](#license)What this tool does
Free online Markdown table of contents generator. Paste a README, a spec, or any .md file and get back a clean nested list of `- [Heading](#anchor)` links you can drop straight into GitHub, GitLab, Bitbucket, or any CommonMark renderer. Pick a depth range (H1–H6, or just H2–H4 for a typical README), toggle hierarchical numbering (1., 1.1, 1.1.1), choose 2 or 4 space indent, and switch anchor flavor between GitHub, GitLab, Bitbucket, and CommonMark — each one matches the host's exact slug rules so your links actually resolve. Bonus: hit "Copy full doc" and we splice the TOC into the document for you, either replacing a `<!-- TOC -->` placeholder or sliding it in right after the first H1. Headings inside fenced code blocks are skipped automatically, and duplicate slugs are deduped GitHub-style (`-1`, `-2`). 100% browser-side.
Tool details
- Input
- Text + Numbers + Structured content
- The page exposes text boxes, numeric controls, file pickers, or structured inputs depending on the tool.
- Output
- Live result + Copy
- The result area focuses on usable output, with copy, download, or preview actions when supported.
- Privacy
- Browser-side processing
- The main tool logic does not call an external API, so inputs normally stay in the current tab.
- Save / share
- No account required
- Open the page and use it; whether results survive refresh depends on the tool.
- Performance budget
- Initial JS <= 14 KB
- No WASM budget is declared, keeping the tool quick to open on mobile.
- Best fit
- Format Converter · Developer
- Category and role tags drive related tools, internal links, and quick fit checks.
How to use
-
1. Input
Paste or drop your content into the tool panel.
-
2. Process
Click the button. All processing is local in your browser.
-
3. Copy / Download
Copy the result or download to disk in one click.
How Markdown TOC Generator fits into your work
Use it when the main problem is getting content from one practical format into another.
Conversion jobs
- Turning pasted content or local files into a handoff-friendly format.
- Previewing a conversion before you use it in a larger workflow.
- Cleaning small format mismatches without opening a full editor.
Conversion checks
- Try a small sample first when the source format is messy.
- Check character encoding, separators, and line endings after conversion.
- Keep the source until the converted output has been reviewed.
Good next steps
These links move the current task into a more complete workflow.
- 1 Markdown to HTML Convert Markdown to clean HTML — headings, lists, code, links, images, tables — instant live preview, browser-only Open
- 2 HTML to Markdown HTML to Markdown — paste rich content, get clean .md with links, code, tables, lists preserved. Open
- 3 Markdown Table Generator Build Markdown tables visually — add/remove rows, column alignment, paste from Excel / CSV — browser-only Open
Real-world use cases
Keeping a 4000-line README navigable on GitHub
Your open-source README has grown to 38 H2/H3 sections and readers scroll forever to find the install steps. Paste the whole file, pick H2-H3, GitHub flavor, and drop the generated list under a `<!-- TOC -->` marker. Next time you add a section, regenerate and "Copy full doc" rewrites only the block between the markers, so the rest of the README stays byte-for-byte the same.
Fixing anchor links that 404 after moving docs to GitLab
You migrated 12 markdown guides from GitHub to a GitLab wiki and half the in-page links broke because GitLab keeps underscores while GitHub strips them. Switch the anchor flavor to GitLab, regenerate each TOC, and the `#my_section` style anchors resolve again. No manual slug guessing across 200-odd headings.
Adding a numbered outline to a 60-page spec
A product spec reviewed by legal needs stable section numbers people can cite in comments ("see 3.2.1"). Turn on hierarchical numbering, set depth H1-H4, and the TOC emits 1., 1.1, 1.1.1 with counters that reset per parent. Anchors stay unchanged, so existing deep links keep working while reviewers get the numbers they asked for.
Skipping headings that live inside code samples
Your tutorial pastes shell sessions where lines like `# build the image` look exactly like H1 headings. A naive regex TOC would list them as real sections. Here, fenced blocks (``` and ~~~) are tracked and skipped, so the outline shows only your actual 9 sections, not the 15 comment lines hiding in the code.
Common pitfalls
Picking H1-H6 for a README dumps every tiny heading into the TOC. For a typical readme, H2-H3 gives sections without the noise; reserve H1-H6 for long specs.
Generating a GitHub-flavored TOC then pasting it into Bitbucket; the links silently fail because Bitbucket needs the `markdown-header-` prefix. Match the anchor flavor to the host before copying.
Re-running "Copy full doc" without `<!-- TOC -->` markers in your file, so the TOC lands after the first H1 instead of where you wanted it. Add the marker pair first to control placement and enable clean re-generation.
Privacy
Everything runs in your browser. Your markdown is parsed locally to build the TOC and never leaves the page or hits a server. The document text is not written into the URL either, so you can safely paste internal specs, unreleased READMEs, or private notes without anything being uploaded or shared. Only your option choices (depth, indent, anchor flavor) live in the URL for share links.
FAQ
Tool combos
Folks in your role tend to reach for these alongside this tool.
- 555 Timer Calculator Astable f = 1.44/((R1+2R2)C) + monostable t = 1.1RC — pick R1, R2, C in Ω/kΩ and µF/nF, read frequency, duty cycle and pulse width — browser-only
- Add Line Numbers Number every line of pasted text — set start, step and separator, zero-pad to align, skip blanks, or strip numbers back off — browser-only
- AES Text Encryptor Encrypt & decrypt text with a password — AES-256-GCM + PBKDF2 via WebCrypto — 100% in your browser, nothing uploaded
- Affine Cipher Encoder & Decoder Encrypt and decrypt the ax+b affine cipher with live modular-inverse check, browser-only