URL slugs are the human-readable part of a web address that identifies a specific page. They seem minor, but they affect click-through rates, rankings, and shareability. Getting them right is simple once you know the rules. Getting them wrong — with spaces, underscores, or keyword stuffing — creates problems that are painful to fix later.

Hyphens vs Underscores: Use Hyphens, Always

Google treats hyphens as word separators and underscores as joining characters. /word-count-tool is read as three separate words. /word_count_tool is read as one word: "wordcounttool".

Google's John Mueller confirmed this in 2018 and it remains unchanged. Use hyphens everywhere, no exceptions. Most CMSs default to hyphens — don't override this setting.

Lowercase Only

URLs are technically case-sensitive on Linux servers. /My-Page and /my-page can be two different pages. This creates duplicate content issues when one version is canonical and the other isn't. Always use lowercase slugs. Google converts uppercase to lowercase in search results displays, but the server still serves both.

Use a slug generator to automatically convert titles to lowercase — it handles the transformation plus spaces-to-hyphens, special character removal, and more.

Keep Slugs Short and Descriptive

The ideal slug is 3–5 words — long enough to describe the page, short enough to be scannable in a search result. Compare:

  • Good: /remove-duplicate-lines
  • Too long: /how-to-remove-duplicate-lines-from-a-text-file-online-for-free
  • Too short: /duplicates

Short slugs are easier to share, look cleaner in backlinks, and are less likely to be truncated in browser address bars or social media previews.

Include Your Target Keyword

Your slug should contain your primary keyword or a close variant. It appears underlined in Google search results and users scan it as a trust signal before clicking. A URL that matches the query the user searched reinforces relevance.

Don't keyword-stuff. /word-counter-free-online-word-counter-tool looks spammy and provides no benefit over /word-counter. One clear keyword or phrase is enough.

Remove Stop Words (Usually)

Stop words are common words like "a", "the", "and", "or", "in", "of", "for". Removing them shortens slugs without losing meaning. "How to find and replace text" becomes /find-replace-text — shorter, just as clear.

Exception: if the stop word is part of the keyword phrase people actually search (e.g., "day of the week calculator"), keep it. Test against your actual target keyword, not a general rule.

Don't Change Slugs After Publishing

Changing a slug after a page is indexed breaks all existing backlinks and resets the page's link equity. If you must change a slug, implement a 301 redirect from old to new. But the backlinks that pointed to the old URL lose a fraction of their value through the redirect. The safest option is to get the slug right the first time.

Before publishing any page, run the title through a slug generator, review the output, and confirm the slug will still make sense at scale — as in, if this URL appeared in a backlink anchor or tweet, would it be clear what the page is about?

Try the Free Tool

Convert any title into an SEO-friendly URL slug instantly — lowercase, hyphens, no special characters.

Generate a Clean Slug →

Frequently Asked Questions

Should URL slugs use hyphens or underscores?

Always use hyphens. Google treats hyphens as word separators and underscores as connectors. A slug with underscores reads as one long joined word in Google's index. This has been confirmed by Google engineers multiple times and hasn't changed.

Do URL slugs affect SEO?

Yes, but modestly. Slugs appear in Google search results and act as a relevance signal. A slug containing your target keyword can improve click-through rate, which is a ranking factor. More importantly, a clean slug builds user trust — people scan URLs before clicking.

How long should a URL slug be?

3 to 5 words is the standard recommendation. Long enough to be descriptive, short enough to be shareable and scannable. Avoid slugs longer than 7–8 words — they get truncated in browser bars and look unwieldy in backlinks.

Should I include the date in my URL slug?

Avoid date-based slugs for evergreen content. /2024/03/how-to-sort-lines/ becomes outdated-looking, making it harder to update content without changing the URL. Use date slugs only for news or time-sensitive content where the date is part of the value.

How do I create a URL slug from a blog post title?

A slug generator converts a title automatically: it lowercases all letters, replaces spaces with hyphens, removes special characters and stop words, and strips trailing/leading hyphens. For manual creation: lowercase the title, replace every space with a hyphen, remove apostrophes and punctuation, and strip filler words.