What Makes a Good URL Slug?
A URL slug is the last part of a web address — the section that describes the specific page. Getting slugs right affects SEO, usability, and link longevity. A well-crafted slug is readable, keyword-rich, short, and permanent.
The Rules of a Good Slug
- Lowercase only. URLs are case-sensitive on most web servers. Using uppercase creates duplicate content risk and confusion. Stick to lowercase always.
- Hyphens as separators. Google treats hyphens as word boundaries and underscores as joiners.
how-to-write= three words.how_to_write= one word. Use hyphens for SEO. - No special characters. Characters like
&,%,#,?,=have special meaning in URLs and must be percent-encoded, making links ugly and fragile. Strip them entirely. - No stop words. Remove filler words like "a," "an," "the," "and," "but" unless they're essential to meaning. "the-best-seo-tools" → "best-seo-tools."
- Short and descriptive. 3–5 words is ideal. The slug should communicate the topic without reading the page.
- Permanent. Once a URL is indexed and linked, changing it loses SEO value unless you redirect. Plan your slugs before publishing.
Slug Examples: Good vs Bad
| Original Title | Bad Slug | Good Slug |
|---|---|---|
| 10 Best SEO Tools in 2026 | 10-Best-SEO-Tools-in-2026 | best-seo-tools-2026 |
| How to Write Better Blog Posts | How_to_Write_Better_Blog_Posts | how-to-write-better-blog-posts |
| Café Review: Amélie's in Paris | Caf%C3%A9-Review-Am%C3%A9lie's-in-Paris | cafe-review-amelies-paris |
| What is a 401(k)? A Beginner's Guide | what-is-a-401(k)?-a-beginners-guide | what-is-a-401k-beginners-guide |
Slugs and SEO: What Actually Matters
Keywords in Slugs
Search engines read URLs as ranking signals. If your target keyword is "home affordability calculator," having that phrase in your slug (/home-affordability-calculator) reinforces the topic relevance. It won't make or break rankings on its own, but it's a confirmed signal.
Keep the slug focused on one or two primary keywords. Don't stuff it with every keyword variant — that dilutes the signal and looks spammy in SERPs.
Slug Length
Google has no stated maximum URL length, but there's a practical limit: long URLs get truncated in search results. URLs over 60–70 characters typically get cut off in the SERP snippet. Keep slugs short enough that the full URL fits in one line — roughly 50–75 characters for the entire URL including the domain.
Stop Word Removal
Words like "a," "an," "the," "in," "on," "and," "or," "but," "of" rarely add search value to a slug. "a-guide-to-the-best-tools-for-writing-on-a-mac" → "guide-best-writing-tools-mac." Same meaning, shorter URL, clearer keyword signal.
Subfolders vs Flat Structure
A common question: should slugs include the category (/blog/how-to-write) or be flat (/how-to-write)? Both can rank. Subfolder structure helps with site architecture and internal linking context. Flat slugs are slightly shorter. The most important thing is consistency — don't mix both styles on the same site.
Technical Slug Rules for Developers
If you're generating slugs programmatically (in a CMS, URL router, or content pipeline), here's what the algorithm should do:
- Normalize Unicode (NFD decomposition)
- Remove combining diacritical marks (
U+0300–U+036F) - Convert to lowercase
- Replace whitespace, underscores, and existing hyphens with the separator character
- Remove all remaining non-alphanumeric characters except the separator
- Replace consecutive separators with a single separator
- Trim leading and trailing separators
This tool follows exactly that algorithm. The output is safe for use in Apache, Nginx, and all major cloud hosting providers without URL encoding.