What Is a URL Slug?
A URL slug (also known as website slug) is the last part of the URL address that serves as a unique identifier of the page.
For example, the article you’re reading now has a URL that looks like this:
https://semrush.com/blog/what-is-a-url-slug/
The URL’s slug is “what-is-a-url-slug”.
Why Is a URL Slug Important for SEO?
A URL slug is often considered a great place to include the target (or primary) keyword of a page.
After all, Google’s John Mueller has confirmed that words in a URL are a ranking factor.
But he also emphasized that it is a “very very lightweight” one, and it primarily helps to assess the page before Google accesses it.
In one of his tweets, Mueller also said:
Keywords in URLs are overrated for Google SEO. Make URLs for users. Also, on mobile you usually don't even see them.
— John Mueller is mostly not here 🐀 (@JohnMu) March 8, 2017
In other words:
Even if having keywords in the URL is a ranking factor, we should not overestimate its effect on rankings.
However, it may still make sense to use the target keyword of a page in a URL slug. Especially considering theuser experience (UX) point of view, which is closely connected to SEO.
Let's take a look at these two examples:
- https://website.com/blog/rock-climbing
- https://website.com/blog/82354
While the first example provides clear information about the content of the post, the latter is just a chain of numbers that doesn't provide any added value.
If someone only saw these two URL addresses, they're much more likely to click the first one. (Regardless of the actual content on either page.)
That's why a URL slug should provide a concise description of a page. As it happens, a great way to do this is to use the target keyword.
Open the tool and enter the broad topic your page covers.
And the tool will return potential keywords you could use. You’ll also find their metrics like search volume (measures how often the term is searched) and keyword difficulty (measures how difficult it is to rank for it).
Review the list carefully to identify a keyword that has a good search volume and a low keyword difficulty score. And, more importantly, the one that truly represents your page’s topic.
URL Slug Best Practices
Let's take a look at some best practices and tips on how to create good URL slugs.
Be Descriptive
As we've already mentioned, the primary role of URL slugs is to make URLs more user-friendly. Therefore, they should describe the content of a page.
- Good URL slug: /best-air-purifier
- Bad URL slug: /2575
Using the target keyword is a great way to achieve this. Why? Because it is usually an accurate, yet very short, description of what the page is about.
This brings us to the next tip …
Make It Concise and Easy to Read
A good URL slug shouldn't be too long. Long URLs are harder to read and/or remember. Try to use fewer than five words in your slug.
- Good URL slug: /abs-exercises
- Bad URL slug: /the-best-abs-exercises-for-all-levels-of-gym-goer
Moreover, a URL that is too long will get truncated in Google search results. While this is not an SEO disaster, it doesn't make the page snippet look very good.
Separate Words
How you separate the words (or not) influences the readability of a URL slug. Separating the words in the slug helps users understand the URL more easily.
- Good URL slug: /best-travel-tips
- Bad URL slug: /besttraveltips
Use Hyphens, Not Underscores
The best practice is to use hyphens to separate words in URLs. Search engines may not correctly interpret other separators (like underscores).
- Good URL slug: /good-old-fashioned-pancakes
- Bad URL slug: /good_old_fashioned_pancakes
Use Lowercase Characters
Since URLs can often be treated as case-sensitive, it is best to stick to lowercase characters to avoid duplicate content issues (which can happen if a specific URL is created both in uppercase and lowercase).
Lowercase URLs are also easier to type manually.
- Good URL slug: /new-york
- Bad URL slug: /New-York
Avoid Special Characters
Google Search Central recommends avoiding non-ASCII (American Standard Code for Information Interchange) characters, such as special characters of some languages or emojis.
- Good URL slug: /emoji-meanings
- Bad URL slug: /😊🚀
Make It Future-Proof
It is best to avoid numbers that are likely to be changed in the future, like a number of tips or ideas or the publishing year.
- Good URL slug: /how-to-write-url-slugs
- Bad URL slug: /10-tips-to-write-url-slugs-in-2022
URL Slugs & WordPress
Since WordPress is the most popular CMS in the world, let's take a closer look at how to change a URL slug in WordPress.
First and foremost, you need to make sure your permalink structure will allow for user-friendly URL slugs.
Go to “Settings” and click “Permalinks.”
Here, you'll be able to select one of the basic permalink structure types or create a custom one. We strongly recommend using the “Post name” structure.
This way, WordPress will automatically create URL slugs based on the title of your page or post. But more importantly, it will allow you to edit the URL slug.
To change a URL slug in WordPress, you'll need to go to the editor of a specific post or page.
Here, in the right panel, you'll find the “URL” section. After clicking the automatically generated slug, you'll be able to edit it.
If you're using the Yoast SEO plugin, you can also change the URL slug in the Yoast SEO panel at the bottom of your editor.
The plugin's “SEO analysis” section will also notify you if your URL slug does not contain your focus keyphrase (i.e., the target keyword).
Take this as a recommendation you can follow if it makes sense for you—not something you need to do at all costs.
As we've established earlier, keywords in URL slugs have a very small SEO impact. You should primarily focus on the UX rather than keyword stuffing.
Read our guide to WordPress SEO to learn more about how to optimize your WordPress website.
FAQs
Are Website Slugs Important for SEO?
Yes, URL slugs are important for SEO. They are an important user experience element. And UX and SEO are closely connected.Words used in URLs are also a very lightweight ranking factor.
What Is the Difference Between a URL Slug and a URL?
The URL is the entire web address of a page, while the URL slug is just the last part of the URL that serves as an identifier of the page.
- URL: https://www.apple.com/shop/iphone-12
- URL slug: /iphone-12
What Happens When You Change the URL Slug?
Once the URL slug is changed, the whole URL address of a page is changed. It means the page can't be accessed through the old URL address anymore.
Every time you change the URL slug, it is best practice to set up a 301 redirect from the old URL to the new one.
This way, you'll prevent users from landing on a 404 error page. As well as a potential loss of traffic and link equity from links pointing to the old URL.
Why Is It Called a Slug?
The name “slug” has been used in journalism. It refers to the practice of using short descriptions of articles for internal purposes.
Web developers supposedly picked up on this terminology and started using it to refer to the descriptive part of the URL.
Ensure Your URL Slugs Are Properly Optimized
To wrap things up, we’ll see how you can find and fix issues associated with your URL slugs.
Use an auditing like Semrush’s Site Audit. It scans your URLs and reports whether there are any common problems associated with them, such as:
- Use of underscores in URLs
- Too many parameters in URLs
- URLs that are too long
The tool also offers advice on how to fix each issue:
Just create your free account and run your first audit!