A slug is the readable part at the end of a URL path that names one specific page. In https://example.com/blog/how-to-brew-cold-brew, the slug is how-to-brew-cold-brew. Content management systems usually build it from the page title, and you can edit it before you publish.
Readers see the slug in the browser's address bar, in shared links and sometimes in search results, so it's worth a few seconds of thought.
Where the slug sits in a URL
A URL has several parts. The slug is the last segment of the URL path:
| Part | Example |
|---|---|
| Scheme | https |
| Host | example.com |
| Path | /blog/how-to-brew-cold-brew |
| Folder (directory) | /blog/ |
| Slug | how-to-brew-cold-brew |
| Query string | ?ref=newsletter |
The folders before the slug describe where the page sits in your URL structure. The slug describes the page itself. In a blog, the slug is the part of the permalink you control most directly.
How Google uses the words in a slug
Google recommends readable words rather than long ID numbers in URLs (Google Search Central). Its SEO Starter Guide adds that parts of the URL can appear in search results as breadcrumbs, and that Google learns those breadcrumbs from the words in the URL.
Keep expectations realistic, though. The same guide says keywords in the domain name or URL path alone have hardly any effect beyond appearing in breadcrumbs (Google Search Central). A good slug helps people decide to click and helps them remember or share the link. It won't lift rankings on its own.
How to write a good slug
- Use words, not codes.
/red-running-shoesbeats/p/48213. - Separate words with hyphens. Google recommends hyphens (
-) and, for historical reasons, advises against underscores (_). Words run together (redrunningshoes) are hard to read. - Use lowercase. Google treats URLs as case sensitive, so
/Shoesand/shoesare different URLs. Pick lowercase and stick to it to avoid duplicates. - Keep it short and specific. Name the topic of the page, usually in two to five words. Drop filler words such as "a", "the" or "and" when the slug still reads clearly, and keep them when they carry meaning:
/how-to-tie-a-tieis clearer than/tie-tie. - Write in your readers' language. Google suggests using words in your audience's language, including non-English words. In links, non-ASCII characters must be percent-encoded (for example,
übecomes%C3%BC). - Leave out dates and numbers that will age.
/best-hiking-bootscan be updated every year./best-hiking-boots-2024needs a new URL or looks stale. - Make each slug unique. Two pages in the same folder can't share a slug, and near-identical slugs for similar topics hint at keyword cannibalization.
| Weak slug | Better slug | Why |
|---|---|---|
/post?id=8812 |
/cold-brew-coffee-ratio |
Words describe the page |
/Cold_Brew_Coffee |
/cold-brew-coffee |
Lowercase and hyphens |
/how-to-make-the-best-cold-brew-coffee-at-home-easy-recipe |
/cold-brew-recipe |
Short and focused |
/cold-brew-guide-2023 |
/cold-brew-guide |
Doesn't age |
The slug doesn't have to match the page title word for word. Titles are long and change over time; a short slug that names the subject stays accurate when you rewrite the headline.
Changing a slug without losing traffic
Changing a slug creates a new URL. Links, bookmarks and search results still point to the old one. If the old URL returns a 404, you lose those visitors and the value that other sites' links passed to the page.
If the change is worth it, do it in this order:
- Set up a server-side permanent redirect (301 or 308) from the old URL to the new one. Google treats a permanent redirect as a signal that the new URL should be the canonical one (Google Search Central).
- Update your internal links to point straight at the new URL.
- Replace the old URL with the new one in your XML sitemap.
- Keep the redirect in place. For site moves, Google advises keeping redirects for as long as possible, generally at least one year, so it can transfer signals to the new URLs. From a visitor's point of view, it suggests keeping them indefinitely (Google Search Central).
Avoid changing slugs just to add a keyword. The gain is small, and every change costs a redirect hop and some time while Google processes the new URL.