The TextKit Slug Generator turns any title or heading into a clean, URL-friendly slug. It lowercases your text, strips accents and special characters, replaces spaces with hyphens, and removes anything that wouldn't be safe in a URL. Type your title, get a slug, copy it into your CMS, router config, or markdown frontmatter.
Slugs are the part of a URL that identifies a specific page — the /how-to-bake-bread in textkit.com/blog/how-to-bake-bread. A good slug is lowercase, hyphen-separated, descriptive, and short. It's a small detail that affects SEO, click-through rates, accessibility, and how easily a link can be shared by voice or in print.
How to use this tool
- Type or paste your title. Drop in any heading, article title, or product name. The slug updates as you type.
- Pick a separator. Hyphens (-) are the SEO-friendly default and what most modern CMSs use. Underscores (_) are valid but less common and treated differently by search engines.
- Choose your options. Toggle whether to strip stopwords (a, the, of) and whether to enforce a max length. Defaults work for most cases.
- Copy the slug. Click Copy to grab the slug and paste it into your CMS permalink field, your router, or your markdown frontmatter.
How it works
A good slug has five properties: it's lowercase, uses only URL-safe characters, separates words with hyphens, is descriptive, and is concise. Our generator produces slugs that meet all five through a multi-step pipeline.
Step 1 — Lowercase: The input is converted to lowercase. URLs are case-sensitive in principle but case-insensitive in practice on most servers, and lowercase slugs avoid canonical-URL issues and look cleaner.
Step 2 — Strip accents: Accented characters like é, ñ, ü are normalized to their base form using Unicode NFKD decomposition, then the combining marks are stripped. So café becomes cafe, München becomes munchen, andNiño becomes nino. This makes URLs work across keyboards and locales where typing accents is difficult.
Step 3 — Replace special characters: Some symbols have meaningful replacements: & becomes and, $ becomes dollar, % becomes percent, @becomes at. Other punctuation is simply removed.
Step 4 — Replace whitespace with hyphens: Any run of whitespace (spaces, tabs, newlines) becomes a single hyphen. So "10 Best Coffee Shops" (with double space) becomes 10-best-coffee-shops, not 10-best--coffee-shops.
Step 5 — Strip non-URL-safe characters: Anything that isn't a lowercase letter, digit, or hyphen is removed. The result is a slug that's safe to paste into any URL.
Step 6 — Collapse and trim: Multiple consecutive hyphens collapse to one, and leading/trailing hyphens are stripped. The final slug is clean and ready to use.
Hyphen vs underscore: This is a long-running debate. Google has historically treated hyphens as word separators and underscores as part of the word — so how-to-bake ranks for "how to bake" while how_to_bake may rank for "how_to_bake" as a single token. For SEO, hyphens win. Use underscores only if you have a specific technical reason (some legacy systems or programming conventions prefer them).
Who uses this tool
Generate clean, SEO-friendly URLs for blog posts directly from the article title.
Turn a page title into a permalink slug for WordPress, Ghost, Contentful, Sanity, or any other CMS.
Generate route names, file names, or anchor IDs from headings — useful in static site generators and docs.
Craft keyword-rich, descriptive URLs that match what users search for and improve click-through.
Create consistent, readable product URL slugs from product names across a catalog.
Generate anchor links and section IDs from headings in markdown docs, READMEs, and wikis.
Convert accented or non-Latin titles to URL-safe ASCII slugs for global audiences.
Build clean, shareable campaign URLs that look professional in print, email, and social posts.
Examples
Lowercase, hyphens for spaces, exclamation stripped, numbers preserved.
Accents stripped (é → e), apostrophe removed, colon removed, hyphens for spaces.
Special chars replaced (& → and, $ → dollar, / → -).
Tips & best practices
- Keep slugs under 60 characters. Long slugs get truncated in search results and are harder to share verbally.
- Include your primary keyword in the slug — Google uses URL words as a minor ranking signal and users use them to decide what to click.
- Strip stopwords (a, the, of, in, for) from slugs to keep them short without losing meaning: 'how-to-bake-bread' beats 'how-to-bake-bread-in-the-oven-for-beginners'.
- Once a page is published and indexed, don't change the slug without setting up a 301 redirect from the old URL. Otherwise you lose SEO equity.
- Use hyphens, not underscores. Google treats hyphens as word separators; underscores are treated as part of the word, hurting keyword matching.
- Avoid years and version numbers in evergreen content slugs — 'best-laptops-2024' feels dated by 2025. Use 'best-laptops' instead.
- If your title contains numbers, keep them. '10-best-tips' is fine — numbers in slugs can improve click-through by setting expectations.
Common mistakes to avoid
- Using underscores instead of hyphens. Google treats 'how_to_bake' as a single token, not as 'how to bake'. Hyphens are the SEO-standard separator.
- Making slugs too long. A 12-word slug gets truncated in search results and looks spammy. Aim for 3–6 words.
- Changing a published slug without a 301 redirect. The old URL breaks, links from other sites 404, and you lose all accumulated SEO equity.
- Including stop words and filler. 'the-best-ways-to-learn-how-to-code-in-2025' is weaker than 'learn-code'. Tighten aggressively.
- Leaving accented characters in the slug. They're technically valid in URLs (when percent-encoded) but break on copy-paste, look ugly, and don't match what users type.
- Using dates or version numbers in evergreen content. 'best-laptops-2023' looks outdated the moment 2024 starts. Use 'best-laptops' and update the content instead.
“Your URL slug is one of the few SEO signals you fully control, and it shows up in three places that matter — search results, the browser address bar, and link previews. Spend ten seconds crafting a clean, keyword-relevant slug for every page. It's the highest ROI SEO action most content teams underuse.”
Frequently asked questions
▸Should I use hyphens or underscores in slugs?
Hyphens. Google treats hyphens as word separators (so 'how-to-bake' ranks for 'how to bake'), but treats underscores as part of the word ('how_to_bake' is seen as a single token). For SEO, hyphens win.
▸How long should a slug be?
Aim for 3–6 words and under 60 characters. Long slugs get truncated in search results, look spammy, and are harder to share verbally. Strip stopwords (a, the, of, in) to keep slugs tight.
▸What happens to accented characters?
They're normalized to their base ASCII form. 'café' becomes 'cafe', 'München' becomes 'munchen', 'Niño' becomes 'nino'. This makes URLs work across all keyboards and locales.
▸Should I include the year in my slug?
Usually no. 'best-laptops-2024' feels outdated by 2025 and forces you to either migrate the URL annually or accept that it looks stale. Use 'best-laptops' and update the content instead.
▸What if I need to change a published slug?
Set up a 301 redirect from the old URL to the new one. Without a redirect, the old URL breaks, inbound links 404, and you lose SEO equity. Most CMSs (WordPress, Ghost, Webflow) handle this automatically.
▸Are numbers OK in slugs?
Yes, and they can improve click-through by setting expectations ('10-best-tips' often outperforms 'best-tips'). Avoid numbers that imply temporality (years, version numbers) in evergreen content.
▸What's the difference between a slug and a URL?
A slug is the last part of a URL that identifies a specific page — the 'how-to-bake-bread' in 'textkit.com/blog/how-to-bake-bread'. The full URL includes the protocol, domain, and path; the slug is just the page identifier.
▸Should I match the slug to the H1 exactly?
Not necessarily. The H1 can be longer and more conversational; the slug should be shorter, keyword-focused, and stripped of stopwords. 'How to Bake Bread at Home: A Complete Beginner's Guide' (H1) can become 'how-to-bake-bread' (slug).
Last reviewed and updated by Muhammad Umair. Have feedback or found an inaccuracy? Let us know.