What a URL slug is, and the rules for a clean one

example.com/guides/what-is-a-url-slug โ€” the last part is the slug: a short, readable label that identifies the page. Good ones are the difference between a link people trust and a string of numbers, and the rules for making them are simple and old. The slug generator applies them; here's why they exist.

What a slug is

The term comes from newspaper production, where a slug was a short name for a story in progress. In URLs it is the human-readable identifier of a page โ€” usually derived from its title โ€” used instead of or alongside a database ID. /post?id=8213 and /how-to-make-a-favicon might be the same page; the second tells the reader, the search engine and the person pasting it into a chat what it is. Blogs, CMSs and e-commerce platforms generate slugs from titles automatically and let you edit them.

The rules

  • Lowercase. URLs are case-sensitive on most servers; /About and /about can be two pages. Lowercase avoids the duplicate.
  • Hyphens between words, never underscores or spaces. Google treats hyphens as word separators and underscores as joiners; a space becomes %20.
  • ASCII letters and digits only. Accents are transliterated (รฉ โ†’ e, รŸ โ†’ ss); non-Latin scripts are either transliterated or kept as Unicode (which browsers display but which percent-encode when copied โ€” URL encoding explained: why spaces become %20 (or +), and what has to be escaped).
  • Drop stop words that add nothing (a, the, of) unless the phrase needs them for sense; keep the words people would search.
  • Short but specific. Three to six words is typical; the slug should still make sense when the title changes.
  • No dates or numbers that will go stale ("best-laptops-2024"), unless the page is genuinely about that year.
  • Unique within its folder; generators append -2 on collision.

What slugs do for SEO and sharing

The direct ranking effect of keywords in a URL is small. The indirect effects are larger: a readable slug shows in the search result (as the breadcrumb path, How long should a title tag be? Pixels, not characters), makes people more willing to click a bare link, is remembered and retyped, and produces anchor text when others paste the URL as a link. Consistent structure โ€” /guides/topic/ rather than a mix of patterns โ€” also makes a site easier to crawl and for you to maintain. UTM parameters sit after a question mark and don't touch the slug.

Changing a slug: redirects

A slug is an address. Change it and every existing link โ€” from other sites, search results, bookmarks, your own pages โ€” breaks with a 404 until you add a 301 redirect from the old URL to the new one (HTTP status codes explained โ€” the ones you'll actually meet, and what to do about them). Do that every time, keep the redirect indefinitely, and expect a brief ranking dip as search engines transfer the signals. The better policy is to get the slug right at publication and then leave it alone even when the title is rewritten, which is why good slugs describe the topic rather than mirroring the exact headline.

Slugs beyond URLs

The same normalisation โ€” lowercase, hyphenated, ASCII โ€” is what makes safe filenames, image names for the web (which also get read by search engines), identifiers in code and CSS classes, and the labels in a bulk export (the bulk QR generator names its files this way). The batch rename tool applies slug rules to a folder of files; the case converter handles the other transformations.

Sources and further reading

The claims in this guide rest on these references, which were checked when the guide was last updated. Spotted an error? The contact page says how to report it.

  1. Clean URL โ€” Wikipedia

Try the tool

Frequently asked questions

Should I use hyphens or underscores in URLs?

Hyphens. Search engines treat them as word separators and underscores as joiners, and hyphens are the convention users expect.

How long should a URL slug be?

As short as stays specific โ€” typically three to six words. Drop filler words, keep the ones people would search.

Do keywords in the URL help SEO?

A little directly, more indirectly: the slug appears in the result and in pasted links, and readable URLs get clicked and shared more.

Can I change a page's slug later?

Yes, with a 301 redirect from the old URL โ€” otherwise every existing link breaks. Better to choose a topic-based slug at publication and leave it.