What a slug is
The slug is the readable part of a URL that names a specific page. In https://example.com/blog/resize-image-without-losing-quality/, the slug is resize-image-without-losing-quality. People see it in search results, in shared links and in the browser bar, so it helps them understand where a link goes before they click.
The rules of a good slug
- Descriptive. It says what the page is about, usually using the main keyword.
- Short. Three to six meaningful words is typical. Drop words that add nothing.
- Lowercase. Some servers treat uppercase and lowercase URLs as different pages, which can create duplicates.
- Hyphens between words. Google recommends hyphens over underscores, and spaces turn into ugly
%20codes. - Plain letters and numbers. No punctuation, symbols or accented characters that may be encoded unpredictably.
- Stable. Avoid dates and years if you plan to update the page.
Examples
| Weak | Better |
|---|---|
/?p=4821 | /xml-sitemap-generator/ |
/The_Ultimate_Guide_To_Resizing_Images_2026 | /resize-image-without-losing-quality/ |
/blog/how-to-write-a-robots-txt-file-the-complete-step-by-step-guide-for-beginners/ | /blog/write-robots-txt/ |
/caf%C3%A9-menu-ideas | /cafe-menu-ideas/ |
The URL slug generator applies these rules automatically: it lowercases, strips accents and punctuation, can remove stop words, and stops at a whole word when the slug gets too long.
Should you remove stop words?
Usually yes. Words like "the", "a", "of" and "to" lengthen a slug without adding meaning, so how-to-write-a-robots-txt-file can become write-robots-txt-file. Keep them when removing them changes the meaning or makes the slug confusing. For example, a page about the band The The needs its "the".
Folders and structure
The folders before the slug matter too. A shallow, logical structure such as /guides/ or /tools/ helps people and search engines understand how pages relate. Avoid deep nesting like /category/sub/sub/sub/page/, and avoid repeating the same word at several levels.
Slugs for different kinds of pages
- Blog posts: the core topic, not the whole headline.
/write-robots-txt/outlives a title change from "How to" to "A Beginner's Guide to". - Product pages: the product name and a key attribute if it separates variants, such as
/linen-shirt-blue/. Avoid internal SKUs unless customers search for them. - Category pages: the plain category name, such as
/running-shoes/. - Tool or service pages: what it does, matched to how people search, such as
/xml-sitemap-generator/. - Local pages: the service plus the place, such as
/plumber-leeds/.
Whatever the type, check the slug reads clearly on its own if someone sees just the link in a message.
Changing a slug on a live page
Sometimes a slug has to change. When it does, set up a permanent (301) redirect from the old URL to the new one, so visitors and search engines that follow old links land in the right place. Update your internal links and sitemap to point straight at the new address. Many CMSs and SEO plugins can create the redirect for you; check it actually works by visiting the old URL.
When you are done, add the new URL to your sitemap with the sitemap generator and check the page with the SEO checker.