Markdown Slug Generator
Preview GitHub heading anchors before you publish
Ship README deep links and documentation TOCs with confidence: inspect slug collisions early, copy nested Markdown lists, and stay aligned with GitHub's heading permalink algorithm — entirely client-side.
Slugs match GitHub's heading algorithm (including -2 suffixes for duplicates).
- [Introduction](#introduction)
- [API Reference](#api-reference)
- [Authentication](#authentication)
- [Errors](#errors)
- [FAQ](#faq)
- [Billing](#billing)Who needs predictable anchors?
- Docs engineers wiring intra-page jumps inside README files or MkDocs sites.
- Training teams publishing reproducible deep links in LMS platforms that slug headings independently.
- OSS maintainers coordinating changelog anchors across forks without preview deployments.
Knowing slugs before merge avoids broken fragment URLs inside automation scripts or Slack bookmarks.
How to use this generator
- Paste Markdown containing ATX headings — starter sample illustrates duplicates.
- Review the GitHub-style anchors table for line numbers, depth, text, and slug.
- Tap any row's copy icon for a single slug (paste after
#in URLs). - Click Copy TOC as Markdown to grab nested bullets ready for README intros.
- Paste into GitHub, GitLab, or static generators — cross-check once if non-Latin scripts dominate titles.
The slug algorithm mirrors Markdown Viewer's internal outline helper, so what you see here matches our editor sidebar and generated blog TOCs.
Slug rules at a glance
| Input nuance | Slug behavior |
|---|---|
| Mixed case | Lowercased entirely |
| Special characters | Stripped; spaces become hyphens |
| Multiple adjacent hyphens | Collapsed to one |
| Duplicate titles | Second occurrence gains -2, third -3, … |
| Closing hashes on headings | Trimmed before slugging |
Other hosts (GitLab, Bitbucket, MDX plugins) sometimes diverge slightly — diff-check important anchors there.
Nested TOC formatting
Indentation mirrors heading depth relative to the shallowest level detected so nested sections remain visually grouped — identical strategy to choosing Generate table of contents inside the editor tools sidebar.
After anchors look good, polish prose with the Markdown formatter or ship exports via Markdown to HTML.
Related deep dives
- Learn Markdown heading syntax in our guide.
- Study tables alongside headings via the Markdown table guide.
Frequently asked questions
- Yes — identical titles receive `-2`, `-3`, … suffixes in scan order, mirroring GitHub's renderer so relative anchor links stay stable.
- Lowercase, punctuation stripped to dashes, whitespace collapsed, trailing hashes trimmed — the same recipe GitHub documents for heading permalinks.
- Emoji remain Unicode characters that slugify down using our normalization rules; compare against GitHub preview when emoji-heavy titles must match exactly.
- Only ATX headings (`#` syntax). Underlined headings aren't detected — normalize them in the [editor](/editor) before generating anchors.
- Absolutely. The nested bullets ship `[text](#slug)` links GitHub understands without extra configuration.
- No. Fenced blocks are ignored so tutorial snippets don't pollute your TOC.